CVS commit: src/sys/dist/ipf/netinet

2012-02-08 Thread Darren Reed
Module Name:src
Committed By:   darrenr
Date:   Thu Feb  9 07:15:28 UTC 2012

Modified Files:
src/sys/dist/ipf/netinet: ip_fil_netbsd.c ip_nat.c

Log Message:
PR kern/45929
ipnat does not remove rules with -r


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/dist/ipf/netinet/ip_fil_netbsd.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dist/ipf/netinet/ip_nat.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/dist/ipf/netinet/ip_fil_netbsd.c
diff -u src/sys/dist/ipf/netinet/ip_fil_netbsd.c:1.59 src/sys/dist/ipf/netinet/ip_fil_netbsd.c:1.60
--- src/sys/dist/ipf/netinet/ip_fil_netbsd.c:1.59	Wed Feb  1 02:21:19 2012
+++ src/sys/dist/ipf/netinet/ip_fil_netbsd.c	Thu Feb  9 07:15:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_fil_netbsd.c,v 1.59 2012/02/01 02:21:19 christos Exp $	*/
+/*	$NetBSD: ip_fil_netbsd.c,v 1.60 2012/02/09 07:15:27 darrenr Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -8,7 +8,7 @@
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.59 2012/02/01 02:21:19 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.60 2012/02/09 07:15:27 darrenr Exp $");
 #else
 static const char sccsid[] = "@(#)ip_fil.c	2.41 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_fil_netbsd.c,v 2.144.2.10 2012/01/29 05:30:36 darrenr Exp";
@@ -638,7 +638,7 @@ ipfioctl(dev_t dev, u_long cmd,
 	}
 
 	if (ipfmain.ipf_running <= 0) {
-		if (unit != IPL_LOGIPF) {
+		if (unit != IPL_LOGIPF && cmd != SIOCIPFINTERROR) {
 			ipfmain.ipf_interror = 130003;
 			return EIO;
 		}

Index: src/sys/dist/ipf/netinet/ip_nat.c
diff -u src/sys/dist/ipf/netinet/ip_nat.c:1.46 src/sys/dist/ipf/netinet/ip_nat.c:1.47
--- src/sys/dist/ipf/netinet/ip_nat.c:1.46	Wed Feb  1 02:21:20 2012
+++ src/sys/dist/ipf/netinet/ip_nat.c	Thu Feb  9 07:15:27 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_nat.c,v 1.46 2012/02/01 02:21:20 christos Exp $	*/
+/*	$NetBSD: ip_nat.c,v 1.47 2012/02/09 07:15:27 darrenr Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -113,7 +113,7 @@ extern struct ifnet vpnif;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_nat.c,v 1.46 2012/02/01 02:21:20 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_nat.c,v 1.47 2012/02/09 07:15:27 darrenr Exp $");
 #else
 static const char sccsid[] = "@(#)ip_nat.c	1.11 6/5/96 (C) 1995 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_nat.c,v 2.357.2.23 2012/01/29 05:30:36 darrenr Exp";
@@ -229,6 +229,7 @@ static	void	ipf_nat_addmap(ipf_nat_softc
 static	void	ipf_nat_addrdr(ipf_nat_softc_t *, ipnat_t *);
 static	int	ipf_nat_builddivertmp(ipf_nat_softc_t *, ipnat_t *);
 static	int	ipf_nat_clearlist(ipf_main_softc_t *, ipf_nat_softc_t *);
+static	int	ipf_nat_cmp_rules(ipnat_t *, ipnat_t *);
 static	int	ipf_nat_decap(fr_info_t *, nat_t *);
 static	void	ipf_nat_del_active(int, u_32_t *);
 static	void	ipf_nat_del_map_mask(ipf_nat_softc_t *, int);
@@ -1273,8 +1274,7 @@ ipf_nat_ioctl(ipf_main_softc_t *softc, v
 		MUTEX_ENTER(&softn->ipf_nat_io);
 		for (np = &softn->ipf_nat_list; ((n = *np) != NULL);
 		 np = &n->in_next)
-			if (!bcmp((char *)&nat->in_v, (char *)&n->in_v,
-	IPN_CMPSIZ))
+			if (ipf_nat_cmp_rules(nat, n) == 0)
 break;
 	}
 
@@ -8896,3 +8896,63 @@ ipf_nat_uncreate(fr_info_t *fin)
 
 	RWLOCK_EXIT(&softc->ipf_nat);
 }
+
+
+/*  */
+/* Function:ipf_nat_cmp_rules   */
+/* Returns: int   - 0 == success, else rules do not match.  */
+/* Parameters:  n1(I) - first rule to compare   */
+/*  n2(I) - first rule to compare   */
+/*  */
+/* Compare two rules using pointers to each rule. A straight bcmp will not  */
+/* work as some fields (such as in_dst, in_pkts) actually do change once*/
+/* the rule has been loaded into the kernel. Whilst this function returns   */
+/* various non-zero returns, they're strictly to aid in debugging. Use of   */
+/* this function should simply care if the result is zero or not.   */
+/*  */
+static int
+ipf_nat_cmp_rules(ipnat_t *n1, ipnat_t *n2)
+{
+	if (n1->in_size != n2->in_size)
+		return 1;
+
+	if (bcmp((char *)&n1->in_v, (char *)&n2->in_v,
+		 offsetof(ipnat_t, in_ndst) - offsetof(ipnat_t, in_v)) != 0)
+		return 2;
+
+	if (bcmp((char *)&n1->in_tuc, (char *)&n2->in_tuc,
+		 offsetof(ipnat_t, in_pkts) - offsetof(ipnat_t, in_tuc)) != 0)
+		return 3;
+	if (bcmp((char *)&n1->in_namelen, (char *)&n2->in_namelen,
+		 n1->in_size  - offsetof(ipnat_t, in_namelen)) != 0)
+		return 4;
+	if (n1->in_ndst.na_atype != n2->in_ndst.na_atype)
+		return 5;
+	

CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 03:35:59 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: vm_machdep.c

Log Message:
Recognize KSEGX as FIRST512M (even though it isn't in the 512M it is
conceptually part of it since it's direct-mapped).


To generate a diff of this commit:
cvs rdiff -u -r1.121.6.1.2.25 -r1.121.6.1.2.26 \
src/sys/arch/mips/mips/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/mips/mips/vm_machdep.c
diff -u src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.25 src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.26
--- src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.25	Thu Feb  9 03:14:45 2012
+++ src/sys/arch/mips/mips/vm_machdep.c	Thu Feb  9 03:35:59 2012
@@ -85,6 +85,12 @@ mips_page_to_pggroup(struct vm_page *pg,
 	&& (mips_freelist_mask & (1 << VM_FREELIST_FIRST512M))) {
 		lcv = VM_FREELIST_FIRST512M;
 	} else
+#ifdef ENABLE_MIPS_KSEGX
+	if (mips_ksegx_start <= pa && pa < mips_ksegx_start + VM_KSEGX_SIZE
+	&& (mips_freelist_mask & (1 << VM_FREELIST_FIRST512M))) {
+		lcv = VM_FREELIST_FIRST512M;
+	} else
+#endif
 #endif
 #ifdef VM_FREELIST_FIRST4G
 	if (VM_FREELIST_FIRST4G_P(pa)



CVS commit: [matt-nb5-mips64] src/usr.bin/vmstat

2012-02-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 03:22:58 UTC 2012

Modified Files:
src/usr.bin/vmstat [matt-nb5-mips64]: vmstat.c

Log Message:
Deal with the changes to uvmexp.  Use sysctl version when possible.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.163.6.1 src/usr.bin/vmstat/vmstat.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/vmstat/vmstat.c
diff -u src/usr.bin/vmstat/vmstat.c:1.163 src/usr.bin/vmstat/vmstat.c:1.163.6.1
--- src/usr.bin/vmstat/vmstat.c:1.163	Wed Oct 22 11:36:58 2008
+++ src/usr.bin/vmstat/vmstat.c	Thu Feb  9 03:22:58 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.163 2008/10/22 11:36:58 matt Exp $ */
+/* vmstat.c,v 1.163 2008/10/22 11:36:58 matt Exp */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)vmstat.c	8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.163 2008/10/22 11:36:58 matt Exp $");
+__RCSID("vmstat.c,v 1.163 2008/10/22 11:36:58 matt Exp");
 #endif
 #endif /* not lint */
 
@@ -699,16 +699,20 @@ dovmstat(struct timespec *interval, int 
 		PRWORD(ovflw, " %*ld", 7, 1, pgtok(total.t_free));
 		PRWORD(ovflw, " %*ld", 5, 1,
 		rate(uvmexp.faults - ouvmexp.faults));
+#if 0
 		PRWORD(ovflw, " %*ld", 4, 1,
 		rate(uvmexp.pdreact - ouvmexp.pdreact));
 		PRWORD(ovflw, " %*ld", 4, 1,
 		rate(uvmexp.pageins - ouvmexp.pageins));
+#endif
 		PRWORD(ovflw, " %*ld", 5, 1,
 		rate(uvmexp.pgswapout - ouvmexp.pgswapout));
+#if 0
 		PRWORD(ovflw, " %*ld", 5, 1,
 		rate(uvmexp.pdfreed - ouvmexp.pdfreed));
 		PRWORD(ovflw, " %*ld", 6, 2,
 		rate(uvmexp.pdscans - ouvmexp.pdscans));
+#endif
 		drvstats(&ovflw);
 		PRWORD(ovflw, " %*ld", 5, 1,
 		rate(uvmexp.intrs - ouvmexp.intrs));
@@ -804,102 +808,187 @@ dosum(void)
 		if (sysctl(mib, 2, &uvmexp2, &ssize, NULL, 0) < 0)
 			fprintf(stderr, "%s: sysctl vm.uvmexp2 failed: %s",
 getprogname(), strerror(errno));
-	}
+	} else {
+		kread(namelist, X_UVMEXP, &uvmexp, sizeof(uvmexp));
+		uvmexp2.pagesize = uvmexp.pagesize;
+		uvmexp2.ncolors = uvmexp.ncolors;
+		uvmexp2.npages = uvmexp.npages;
+		uvmexp2.free = uvmexp.free;
+		uvmexp2.paging = uvmexp.paging;
+		uvmexp2.wired = uvmexp.wired;
+		uvmexp2.zeropages = uvmexp.zeropages;
+		uvmexp2.reserve_pagedaemon = uvmexp.reserve_pagedaemon;
+		uvmexp2.reserve_kernel = uvmexp.reserve_kernel;
+		uvmexp2.anonpages = uvmexp.anonpages;
+		uvmexp2.filepages = uvmexp.filepages;
+		uvmexp2.execpages = uvmexp.execpages;
+
+		uvmexp2.freemin = uvmexp.freemin;
+		uvmexp2.freetarg = uvmexp.freetarg;
+		uvmexp2.wiredmax = uvmexp.wiredmax;
+
+		uvmexp2.nswapdev = uvmexp.nswapdev;
+		uvmexp2.swpages = uvmexp.swpages;
+		uvmexp2.swpginuse = uvmexp.swpginuse;
+		uvmexp2.nswget = uvmexp.nswget;
+
+		uvmexp2.faults = uvmexp.faults;
+		uvmexp2.traps = uvmexp.traps;
+		uvmexp2.intrs = uvmexp.intrs;
+		uvmexp2.swtch = uvmexp.swtch;
+		uvmexp2.softs = uvmexp.softs;
+		uvmexp2.syscalls = uvmexp.syscalls;
+		uvmexp2.pageins = uvmexp.pageins;
+		uvmexp2.pdpageouts = uvmexp.pdpageouts;
+		uvmexp2.swapins = uvmexp.swapins;
+		uvmexp2.swapouts = uvmexp.swapouts;
+		uvmexp2.pgswapin = uvmexp.pgswapin;
+		uvmexp2.pgswapout = uvmexp.pgswapout;
+		uvmexp2.forks = uvmexp.forks;
+		uvmexp2.forks_ppwait = uvmexp.forks_ppwait;
+		uvmexp2.forks_sharevm = uvmexp.forks_sharevm;
+		uvmexp2.pga_zerohit = uvmexp.pga_zerohit;
+		uvmexp2.pga_zeromiss = uvmexp.pga_zeromiss;
+		uvmexp2.zeroaborts = uvmexp.zeroaborts;
+
+		uvmexp2.colorany = uvmexp2.colorany;
+		uvmexp2.colorfail = uvmexp2.colorfail;
+		uvmexp2.colorhit = uvmexp2.colorhit;
+		uvmexp2.colormiss = uvmexp2.colormiss;
+		uvmexp2.cpuhit = uvmexp2.cpuhit;
+		uvmexp2.cpumiss = uvmexp2.cpumiss;
+
+		uvmexp2.fltnoram = uvmexp.fltnoram;
+		uvmexp2.fltnoanon = uvmexp.fltnoanon;
+		uvmexp2.fltpgwait = uvmexp.fltpgwait;
+		uvmexp2.fltpgrele = uvmexp.fltpgrele;
+		uvmexp2.fltrelck = uvmexp.fltrelck,
+		uvmexp2.fltrelckok = uvmexp.fltrelckok;
+		uvmexp2.fltanget = uvmexp.fltanget;
+		uvmexp2.fltanretry = uvmexp.fltanretry;
+		uvmexp2.fltamcopy = uvmexp.fltamcopy;
+		uvmexp2.fltnamap = uvmexp.fltnamap;
+		uvmexp2.fltnomap = uvmexp.fltnomap;
+		uvmexp2.fltlget = uvmexp.fltlget;
+		uvmexp2.fltget = uvmexp.fltget;
+		uvmexp2.flt_anon = uvmexp.flt_anon;
+		uvmexp2.flt_acow = uvmexp.flt_acow;
+		uvmexp2.flt_obj = uvmexp.flt_obj;
+		uvmexp2.flt_prcopy = uvmexp.flt_prcopy;
+		uvmexp2.flt_przero = uvmexp.flt_przero;
 
-	kread(namelist, X_UVMEXP, &uvmexp, sizeof(uvmexp));
+#if 0
+		uvmexp2.pdwoke = uvmexp.pdwoke;
+		uvmexp2.pdrevs = uvmexp.pdrevs;
+		uvmexp2.pdswout = uvmexp.pdswout;
+		uvmexp2.pdfreed = uvmexp.pdfreed;
+		uvmexp2.pdscans = uvmexp.pdscans;
+		uvmexp2.pdanscan = uvmexp.pdanscan;
+		uvmexp2.pdobscan = uvmexp.pdobscan;
+		uvmexp2.pdreact = uvmexp.pdreact;
+		uvmexp2.pdbusy = uvmexp.p

CVS commit: [matt-nb5-mips64] src/sys/rump/librump/rumpkern

2012-02-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 03:15:18 UTC 2012

Modified Files:
src/sys/rump/librump/rumpkern [matt-nb5-mips64]: vm.c

Log Message:
Update uvm_pageout_done defintion.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.41.8.1 src/sys/rump/librump/rumpkern/vm.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/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.41 src/sys/rump/librump/rumpkern/vm.c:1.41.8.1
--- src/sys/rump/librump/rumpkern/vm.c:1.41	Wed Oct 15 13:04:26 2008
+++ src/sys/rump/librump/rumpkern/vm.c	Thu Feb  9 03:15:18 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.41 2008/10/15 13:04:26 pooka Exp $	*/
+/*	vm.c,v 1.41 2008/10/15 13:04:26 pooka Exp	*/
 
 /*
  * Copyright (c) 2007 Antti Kantee.  All Rights Reserved.
@@ -81,6 +81,8 @@ const struct uvm_pagerops aobj_pager = {
 	.pgo_put = ao_put,
 };
 
+struct uvm_pggroup uvm_pggroup_store;
+
 kmutex_t uvm_pageqlock;
 
 struct uvmexp uvmexp;
@@ -517,7 +519,7 @@ uvm_page_unbusy(struct vm_page **pgs, in
 }
 
 void
-uvm_estimatepageable(int *active, int *inactive)
+uvm_estimatepageable(u_int *active, u_int *inactive)
 {
 
 	/* XXX: guessing game */
@@ -639,17 +641,17 @@ vm_map_starved_p(struct vm_map *map)
 }
 
 void
-uvm_pageout_start(int npages)
+uvm_pageout_start(struct uvm_pggroup *grp, u_int npages)
 {
 
 	uvmexp.paging += npages;
 }
 
 void
-uvm_pageout_done(int npages)
+uvm_pageout_done(struct vm_page *pg, bool freed)
 {
 
-	uvmexp.paging -= npages;
+	uvmexp.paging -= 1;
 
 	/*
 	 * wake up either of pagedaemon or LWPs waiting for it.
@@ -660,6 +662,7 @@ uvm_pageout_done(int npages)
 	} else {
 		wakeup(&uvmexp.free);
 	}
+	return NULL;
 }
 
 /* XXX: following two are unfinished because lwp's are not refcounted yet */
@@ -767,3 +770,9 @@ uvm_km_free_poolpage(struct vm_map *map,
 
 	rumpuser_free((void *)addr);
 }
+
+struct uvm_pggroup *
+uvm_page_to_pggroup(struct vm_page *pg)
+{
+	return &uvm_pggroup_store;
+}



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2012-02-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 03:14:46 UTC 2012

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: vmparam.h
src/sys/arch/mips/mips [matt-nb5-mips64]: mips_machdep.c pmap.c
pmap_segtab.c vm_machdep.c

Log Message:
Add mips_page_to_pggroup which return what pggroup a page belongs to.
Eradicate VM_FREELIST_MAX
When adding pages to the system, track what freelists get pages.


To generate a diff of this commit:
cvs rdiff -u -r1.41.28.25 -r1.41.28.26 src/sys/arch/mips/include/vmparam.h
cvs rdiff -u -r1.205.4.1.2.1.2.62 -r1.205.4.1.2.1.2.63 \
src/sys/arch/mips/mips/mips_machdep.c
cvs rdiff -u -r1.179.16.35 -r1.179.16.36 src/sys/arch/mips/mips/pmap.c
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/arch/mips/mips/pmap_segtab.c
cvs rdiff -u -r1.121.6.1.2.24 -r1.121.6.1.2.25 \
src/sys/arch/mips/mips/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/mips/include/vmparam.h
diff -u src/sys/arch/mips/include/vmparam.h:1.41.28.25 src/sys/arch/mips/include/vmparam.h:1.41.28.26
--- src/sys/arch/mips/include/vmparam.h:1.41.28.25	Tue Dec 27 16:09:36 2011
+++ src/sys/arch/mips/include/vmparam.h	Thu Feb  9 03:14:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.41.28.25 2011/12/27 16:09:36 matt Exp $	*/
+/*	vmparam.h,v 1.41.28.25 2011/12/27 16:09:36 matt Exp	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -208,9 +208,8 @@
 #define	VM_PHYSSEG_NOADD	/* can add RAM after vm_mem_init */
 
 #ifndef VM_NFREELIST
-#define	VM_NFREELIST		16	/* 16 distinct memory segments */
+#define	VM_NFREELIST		1	/* 16 distinct memory segments */
 #define VM_FREELIST_DEFAULT	0
-#define VM_FREELIST_MAX		1
 #endif
 
 #ifdef _KERNEL
@@ -287,4 +286,14 @@ do {\
 	(md)->pvh_attrs = 0;	\
 } while (/* CONSTCOND */ 0)
 
+#define	VM_NPGGROUP(colors)		(mips_nfreelist * (colors))
+#define	VM_PAGE_TO_PGGROUP(pg, ncolors)	(mips_page_to_pggroup((pg), (ncolors)))
+
+#ifdef _KERNEL
+extern u_int mips_nfreelist;
+extern uint32_t mips_freelist_mask;
+struct vm_page;
+extern size_t mips_page_to_pggroup(struct vm_page *, size_t); 
+#endif
+
 #endif /* ! _MIPS_VMPARAM_H_ */

Index: src/sys/arch/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.62 src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.63
--- src/sys/arch/mips/mips/mips_machdep.c:1.205.4.1.2.1.2.62	Sat Jan 28 08:05:03 2012
+++ src/sys/arch/mips/mips/mips_machdep.c	Thu Feb  9 03:14:45 2012
@@ -2126,6 +2126,8 @@ mips_init_lwp0_uarea(void)
 }
 
 int mips_poolpage_vmfreelist = VM_FREELIST_DEFAULT;
+u_int mips_nfreelist;
+uint32_t mips_freelist_mask = 0;
 
 #define	HALFGIG		((paddr_t)512 * 1024 * 1024)
 #define	FOURGIG		((paddr_t)4 * 1024 * 1024 * 1024)
@@ -2144,6 +2146,7 @@ mips_page_physload(vaddr_t vkernstart, v
 #ifdef VM_FREELIST_FIRST4G
 	bool need4g = false;
 #endif
+	CTASSERT(VM_NFREELIST <= 32);
 
 	/*
 	 * Do a first pass and see what ranges memory we have to deal with.
@@ -2152,7 +2155,9 @@ mips_page_physload(vaddr_t vkernstart, v
 #ifdef VM_FREELIST_FIRST4G
 		if (round_page(segs[i].start + segs[i].size) > FOURGIG) {
 			need4g = true;
+#ifdef _LP64
 			mips_poolpage_vmfreelist = VM_FREELIST_FIRST4G;
+#endif
 		}
 #endif
 #ifdef VM_FREELIST_FIRST512M
@@ -2279,11 +2284,21 @@ mips_page_physload(vaddr_t vkernstart, v
 			uvm_page_physload(first, last, first, last, freelist);
 
 			/*
+			 * Mark that we loaded pages of this freelist type.
+			 */
+			mips_freelist_mask |= (1 << freelist);
+
+			/*
 			 * Start where we finished.
 			 */
 			segstart = segend;
 		}
 	}
+
+	/*
+	 * Now to get the number of freelists in use.
+	 */
+	mips_nfreelist = popcount32(mips_freelist_mask);
 }
 
 /* 

Index: src/sys/arch/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.179.16.35 src/sys/arch/mips/mips/pmap.c:1.179.16.36
--- src/sys/arch/mips/mips/pmap.c:1.179.16.35	Fri Dec 23 22:31:30 2011
+++ src/sys/arch/mips/mips/pmap.c	Thu Feb  9 03:14:45 2012
@@ -2541,7 +2541,7 @@ pmap_pv_page_free(struct pool *pp, void 
 	struct vm_page * const pg = PHYS_TO_VM_PAGE(pa);
 	KASSERT(pg != NULL);
 	pmap_clear_mdpage_attributes(VM_PAGE_TO_MD(pg), PG_MD_POOLPAGE);
-	uvm_pagefree(pg);
+	uvm_km_pagefree(pg);
 }
 
 pt_entry_t *
@@ -2594,17 +2594,23 @@ pmap_prefer(vaddr_t foff, vaddr_t *vap, 
 struct vm_page *
 mips_pmap_alloc_poolpage(int flags)
 {
+	struct vm_page *pg;
 	/*
 	 * On 32bit kernels, we must make sure that we only allocate pages that
 	 * can be mapped via KSEG0.  On 64bit kernels, try to allocated from
 	 * the first 4G.  If all memory is in KSEG0/4G, then we can just
 	 * use the default freelist otherwise we must use the pool page list.
 	 */
-	if (mips_poolpage_vmfreelist != VM_FREELIST_DEFAULT)
-		return uvm_pagealloc_strat(NULL, 0, NULL, flags,
+	if (mips_poolpage_vmfreelist != VM_FREELIST_DEFAULT) {
+		pg = uvm_pagealloc_strat(NULL, 0, NULL, flags,
 		UVM_PG

CVS commit: [matt-nb5-mips64] src/sys/arch/evbmips/conf

2012-02-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 03:12:09 UTC 2012

Modified Files:
src/sys/arch/evbmips/conf [matt-nb5-mips64]: MALTA32

Log Message:
Get rid of dead lines.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/evbmips/conf/MALTA32

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/evbmips/conf/MALTA32
diff -u src/sys/arch/evbmips/conf/MALTA32:1.1.2.2 src/sys/arch/evbmips/conf/MALTA32:1.1.2.3
--- src/sys/arch/evbmips/conf/MALTA32:1.1.2.2	Wed Aug 26 04:47:29 2009
+++ src/sys/arch/evbmips/conf/MALTA32	Thu Feb  9 03:12:09 2012
@@ -1,11 +1,9 @@
-# $NetBSD: MALTA32,v 1.1.2.2 2009/08/26 04:47:29 matt Exp $
+# MALTA32,v 1.1.2.2 2009/08/26 04:47:29 matt Exp
 #
 include "arch/evbmips/conf/MALTA"
 
 makeoptions	LP64="no"
 
 no options	MIPS32
-#options 	EXEC_ELF64
 
 no ath*
-



CVS commit: [matt-nb5-mips64] src/sys/arch/evbmips/include

2012-02-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 03:11:39 UTC 2012

Modified Files:
src/sys/arch/evbmips/include [matt-nb5-mips64]: vmparam.h

Log Message:
VM_FREELIST_MAX is not used by anything.  Should be VM_NFREELIST
Add macros to test a PA to see if it belonds to a VM_FREELIST_*


To generate a diff of this commit:
cvs rdiff -u -r1.1.142.5 -r1.1.142.6 src/sys/arch/evbmips/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/evbmips/include/vmparam.h
diff -u src/sys/arch/evbmips/include/vmparam.h:1.1.142.5 src/sys/arch/evbmips/include/vmparam.h:1.1.142.6
--- src/sys/arch/evbmips/include/vmparam.h:1.1.142.5	Tue Nov 29 07:48:32 2011
+++ src/sys/arch/evbmips/include/vmparam.h	Thu Feb  9 03:11:39 2012
@@ -1,19 +1,21 @@
-/*	$NetBSD: vmparam.h,v 1.1.142.5 2011/11/29 07:48:32 matt Exp $	*/
+/*	vmparam.h,v 1.1.142.5 2011/11/29 07:48:32 matt Exp	*/
 
 #ifndef _EVBMIPS_VMPARAM_H_
 #define _EVBMIPS_VMPARAM_H_
 
 #include 
 
-#define	VM_PHYSSEG_MAX		32
+#define	VM_PHYSSEG_MAX			32
 
-#undef VM_FREELIST_MAX
-#define	VM_FREELIST_MAX		3
+#undef VM_NFREELIST
+#define	VM_NFREELIST			3
 #if defined(_MIPS_PADDR_T_64BIT) || defined(_LP64)
-#define	VM_FREELIST_FIRST4G	2
+#define	VM_FREELIST_FIRST4G		2
+#define	VM_FREELIST_FIRST4G_P(pa)	(((pa) >> 32) == 0)
 #endif
 #if !defined(_LP64)
-#define	VM_FREELIST_FIRST512M	1
+#define	VM_FREELIST_FIRST512M		1
+#define	VM_FREELIST_FIRST512M_P(pa)	(((pa) >> 29) == 0)
 #endif
 
 #define	VM_FREELIST_NORMALOK_P(lcv) \



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/mips

2012-02-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 03:10:06 UTC 2012

Modified Files:
src/sys/arch/mips/mips [matt-nb5-mips64]: trap.c

Log Message:
When printing a stack trace, use +0x# so you can c&p easily into gdb.


To generate a diff of this commit:
cvs rdiff -u -r1.217.12.40 -r1.217.12.41 src/sys/arch/mips/mips/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/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.217.12.40 src/sys/arch/mips/mips/trap.c:1.217.12.41
--- src/sys/arch/mips/mips/trap.c:1.217.12.40	Thu Jan 19 08:28:50 2012
+++ src/sys/arch/mips/mips/trap.c	Thu Feb  9 03:10:05 2012
@@ -1083,7 +1083,7 @@ mips3_eret:
 done:
 	if (mask & (1 << _R_RA))
 		ra = regs[_R_RA];
-	(*printfn)("%#"PRIxVADDR": %s+%"PRIxVADDR" (%"PRIxREGISTER",%"PRIxREGISTER",%"PRIxREGISTER",%"PRIxREGISTER") ra %"PRIxVADDR" sz %d\n",
+	(*printfn)("%#"PRIxVADDR": %s+%#"PRIxVADDR" (%"PRIxREGISTER",%"PRIxREGISTER",%"PRIxREGISTER",%"PRIxREGISTER") ra %"PRIxVADDR" sz %d\n",
 		sp, fn_name(subr), pc - subr,
 		regs[_R_A0], regs[_R_A1], regs[_R_A2], regs[_R_A3],
 		ra, stksize);



CVS commit: [matt-nb5-mips64] src/sys

2012-02-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb  9 03:08:32 UTC 2012

Modified Files:
src/sys/miscfs/genfs [matt-nb5-mips64]: genfs_io.c
src/sys/ufs/lfs [matt-nb5-mips64]: lfs_vfsops.c

Log Message:
Change to use the updated uvm_pageout_* signature.


To generate a diff of this commit:
cvs rdiff -u -r1.13.4.2.4.3 -r1.13.4.2.4.4 src/sys/miscfs/genfs/genfs_io.c
cvs rdiff -u -r1.267.6.1 -r1.267.6.1.4.1 src/sys/ufs/lfs/lfs_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/miscfs/genfs/genfs_io.c
diff -u src/sys/miscfs/genfs/genfs_io.c:1.13.4.2.4.3 src/sys/miscfs/genfs/genfs_io.c:1.13.4.2.4.4
--- src/sys/miscfs/genfs/genfs_io.c:1.13.4.2.4.3	Wed May 25 23:58:48 2011
+++ src/sys/miscfs/genfs/genfs_io.c	Thu Feb  9 03:08:31 2012
@@ -1101,7 +1101,9 @@ retry:
 if (tpg->flags & PG_BUSY) {
 	tpg->flags |= freeflag;
 	if (pagedaemon) {
-		uvm_pageout_start(1);
+		uvm_pageout_start(
+		uvm_page_to_pggroup(tpg),
+		1);
 		uvm_pagedequeue(tpg);
 	}
 } else {
@@ -1114,8 +1116,9 @@ retry:
 
 	nextpg = TAILQ_NEXT(tpg, listq.queue);
 	uvm_pagefree(tpg);
-	if (pagedaemon)
-		uvmexp.pdfreed++;
+	if (pagedaemon) {
+		uvm_page_to_pggroup(tpg)->pgrp_pdfreed++;
+	}
 }
 			}
 		}

Index: src/sys/ufs/lfs/lfs_vfsops.c
diff -u src/sys/ufs/lfs/lfs_vfsops.c:1.267.6.1 src/sys/ufs/lfs/lfs_vfsops.c:1.267.6.1.4.1
--- src/sys/ufs/lfs/lfs_vfsops.c:1.267.6.1	Sat Apr  4 18:11:17 2009
+++ src/sys/ufs/lfs/lfs_vfsops.c	Thu Feb  9 03:08:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_vfsops.c,v 1.267.6.1 2009/04/04 18:11:17 snj Exp $	*/
+/*	lfs_vfsops.c,v 1.267.6.1 2009/04/04 18:11:17 snj Exp	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.267.6.1 2009/04/04 18:11:17 snj Exp $");
+__KERNEL_RCSID(0, "lfs_vfsops.c,v 1.267.6.1 2009/04/04 18:11:17 snj Exp");
 
 #if defined(_KERNEL_OPT)
 #include "opt_lfs.h"
@@ -1630,7 +1630,7 @@ lfs_gop_write(struct vnode *vp, struct v
 			KASSERT(!(pgs[i]->flags & PG_PAGEOUT));
 			pgs[i]->flags &= ~PG_DELWRI;
 			pgs[i]->flags |= PG_PAGEOUT;
-			uvm_pageout_start(1);
+			uvm_pageout_start(uvm_page_to_pggroup(pg), 1);
 			mutex_enter(&uvm_pageqlock);
 			uvm_pageunwire(pgs[i]);
 			mutex_exit(&uvm_pageqlock);
@@ -1815,7 +1815,7 @@ lfs_gop_write(struct vnode *vp, struct v
 		pg = pgs[i];
 
 		if (pg->flags & PG_PAGEOUT)
-			uvm_pageout_done(1);
+			uvm_pageout_done(pg, false);
 		if (pg->flags & PG_DELWRI) {
 			uvm_pageunwire(pg);
 		}



CVS commit: src/sys/ddb

2012-02-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Feb  9 00:21:23 UTC 2012

Modified Files:
src/sys/ddb: db_sym.c

Log Message:
Remove bogus code in the non kernel case involving end[]. In this case
end[] is the end of the crash program symbols, so using that as the
end of the kernel symbol table is just wrong.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/ddb/db_sym.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/ddb/db_sym.c
diff -u src/sys/ddb/db_sym.c:1.61 src/sys/ddb/db_sym.c:1.62
--- src/sys/ddb/db_sym.c:1.61	Mon Apr 11 00:26:18 2011
+++ src/sys/ddb/db_sym.c	Wed Feb  8 19:21:23 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_sym.c,v 1.61 2011/04/11 04:26:18 mrg Exp $	*/
+/*	$NetBSD: db_sym.c,v 1.62 2012/02/09 00:21:23 christos Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_sym.c,v 1.61 2011/04/11 04:26:18 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_sym.c,v 1.62 2012/02/09 00:21:23 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddbparam.h"
@@ -300,12 +300,7 @@ db_symbol_values(db_sym_t sym, const cha
  * bogus symbol associations, e.g. 3 might get some absolute
  * value like _INCLUDE_VERSION or something, therefore we do
  * not accept symbols whose value is zero (and use plain hex).
- * Also, avoid printing as "end+0x" which is useless.
- * The variable db_lastsym is used instead of "end" in case we
- * add support for symbols in loadable driver modules.
  */
-extern char end[];
-unsigned long	db_lastsym = (unsigned long)end;
 unsigned int	db_maxoff = 0x10;
 
 void
@@ -325,29 +320,27 @@ db_symstr(char *buf, size_t buflen, db_e
 		int 		linenum;
 		db_sym_t	cursym;
 
-		if ((unsigned long) off <= db_lastsym) {
-			cursym = db_search_symbol(off, strategy, &d);
-			db_symbol_values(cursym, &name, &value);
-			if (name != NULL &&
-			((unsigned int) d < db_maxoff) &&
-			value != 0) {
-strlcpy(buf, name, buflen);
-if (d) {
-	strlcat(buf, "+", buflen);
-	db_format_radix(buf+strlen(buf),
-	24, d, true);
-}
-if (strategy == DB_STGY_PROC) {
-	if ((*db_symformat->sym_line_at_pc)
-	(NULL, cursym, &filename,
-	&linenum, off))
-		snprintf(buf + strlen(buf),
-		buflen - strlen(buf),
-		" [%s:%d]",
-		filename, linenum);
-}
-return;
+		cursym = db_search_symbol(off, strategy, &d);
+		db_symbol_values(cursym, &name, &value);
+		if (name != NULL &&
+		((unsigned int) d < db_maxoff) &&
+		value != 0) {
+			strlcpy(buf, name, buflen);
+			if (d) {
+strlcat(buf, "+", buflen);
+db_format_radix(buf+strlen(buf),
+24, d, true);
+			}
+			if (strategy == DB_STGY_PROC) {
+if ((*db_symformat->sym_line_at_pc)
+(NULL, cursym, &filename,
+&linenum, off))
+	snprintf(buf + strlen(buf),
+	buflen - strlen(buf),
+	" [%s:%d]",
+	filename, linenum);
 			}
+			return;
 		}
 		strlcpy(buf, db_num_to_str(off), buflen);
 		return;
@@ -402,28 +395,26 @@ db_printsym(db_expr_t off, db_strategy_t
 		int 		linenum;
 		db_sym_t	cursym;
 
-		if ((unsigned long) off <= db_lastsym) {
-			cursym = db_search_symbol(off, strategy, &d);
-			db_symbol_values(cursym, &name, &value);
-			if (name != NULL &&
-			((unsigned int) d < db_maxoff) &&
-			value != 0) {
-(*pr)("%s", name);
-if (d) {
-	char tbuf[24];
-
-	db_format_radix(tbuf, 24, d, true);
-	(*pr)("+%s", tbuf);
-}
-if (strategy == DB_STGY_PROC) {
-	if ((*db_symformat->sym_line_at_pc)
-	(NULL, cursym, &filename,
-	&linenum, off))
-		(*pr)(" [%s:%d]",
-		filename, linenum);
-}
-return;
+		cursym = db_search_symbol(off, strategy, &d);
+		db_symbol_values(cursym, &name, &value);
+		if (name != NULL &&
+		((unsigned int) d < db_maxoff) &&
+		value != 0) {
+			(*pr)("%s", name);
+			if (d) {
+char tbuf[24];
+
+db_format_radix(tbuf, 24, d, true);
+(*pr)("+%s", tbuf);
 			}
+			if (strategy == DB_STGY_PROC) {
+if ((*db_symformat->sym_line_at_pc)
+(NULL, cursym, &filename,
+&linenum, off))
+	(*pr)(" [%s:%d]",
+	filename, linenum);
+			}
+			return;
 		}
 		(*pr)(db_num_to_str(off));
 		return;



CVS commit: src/sys/arch/x68k/stand/loadbsd

2012-02-08 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Feb  8 23:51:37 UTC 2012

Modified Files:
src/sys/arch/x68k/stand/loadbsd: Makefile

Log Message:
Don't depend on cat pages to be installed, just run mandoc here.
Also provide a HTML version for user of modern technology.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x68k/stand/loadbsd/Makefile

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/x68k/stand/loadbsd/Makefile
diff -u src/sys/arch/x68k/stand/loadbsd/Makefile:1.13 src/sys/arch/x68k/stand/loadbsd/Makefile:1.14
--- src/sys/arch/x68k/stand/loadbsd/Makefile:1.13	Wed Apr 13 11:10:49 2011
+++ src/sys/arch/x68k/stand/loadbsd/Makefile	Wed Feb  8 23:51:37 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2011/04/13 11:10:49 he Exp $
+#	$NetBSD: Makefile,v 1.14 2012/02/08 23:51:37 joerg Exp $
 
 S=	${.CURDIR}/../../../..
 
@@ -54,6 +54,7 @@ ${BASE}${i}:	${OBJS} ${LIBDOS}/libdos.a 
 release: check_RELEASEDIR
 	${HOST_INSTALL_FILE} -m ${NONBINMODE} ${PROG} \
 	${RELEASEDIR}/${MACHINE}/installation/misc
-	${HOST_INSTALL_FILE} -m ${NONBINMODE} \
-	${DESTDIR}/usr/share/man/cat8/x68k/loadbsd.0 \
-	${RELEASEDIR}/${MACHINE}/installation/misc
+	${TOOL_MANDOC_ASCII} ${DESTDIR}/usr/share/man/man8/x68k/loadbsd.8 > \
+	${RELEASEDIR}/${MACHINE}/installation/misc/loadbsd.0
+	${TOOL_MANDOC_HTML} ${DESTDIR}/usr/share/man/man8/x68k/loadbsd.8 > \
+	${RELEASEDIR}/${MACHINE}/installation/misc/loadbsd.html



CVS commit: src/sys/arch/usermode

2012-02-08 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Feb  8 17:55:21 UTC 2012

Modified Files:
src/sys/arch/usermode/include: cpu.h types.h vmparam.h
src/sys/arch/usermode/usermode: machdep.c

Log Message:
Fix /dev/kmem access and make vmstat(1) `work'. Not sure all the results are
indeed valid or correct but at least it shows them without coredumping or
coredumping the kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/usermode/include/cpu.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/usermode/include/types.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/usermode/include/vmparam.h
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/usermode/usermode/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/usermode/include/cpu.h
diff -u src/sys/arch/usermode/include/cpu.h:1.9 src/sys/arch/usermode/include/cpu.h:1.10
--- src/sys/arch/usermode/include/cpu.h:1.9	Thu Jan 19 12:14:49 2012
+++ src/sys/arch/usermode/include/cpu.h	Wed Feb  8 17:55:21 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.9 2012/01/19 12:14:49 reinoud Exp $ */
+/* $NetBSD: cpu.h,v 1.10 2012/02/08 17:55:21 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -50,10 +50,10 @@ extern void cpu_need_resched(struct cpu_
 
 
 struct cpu_info {
-	device_t	ci_dev;
+	struct cpu_data	ci_data;		/* MI per-cpu data */
+	device_t	ci_dev;			/* pointer to our device */
 	struct cpu_info	*ci_self;
 	struct cpu_info	*ci_next;
-	struct cpu_data	ci_data;
 	u_int		ci_cpuid;
 	int		ci_want_resched;
 	int		ci_idepth;

Index: src/sys/arch/usermode/include/types.h
diff -u src/sys/arch/usermode/include/types.h:1.7 src/sys/arch/usermode/include/types.h:1.8
--- src/sys/arch/usermode/include/types.h:1.7	Sun Jan  8 18:06:00 2012
+++ src/sys/arch/usermode/include/types.h	Wed Feb  8 17:55:21 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.7 2012/01/08 18:06:00 jmcneill Exp $ */
+/* $NetBSD: types.h,v 1.8 2012/02/08 17:55:21 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -62,4 +62,7 @@ typedef volatile unsigned char	__cpu_sim
 #define __HAVE_OLD_DISKLABEL
 #endif
 
+#define __HAVE_CPU_DATA_FIRST
+#define __HAVE_MM_MD_KERNACC
+
 #endif /* !_ARCH_USERMODE_INCLUDE_TYPES_H */

Index: src/sys/arch/usermode/include/vmparam.h
diff -u src/sys/arch/usermode/include/vmparam.h:1.15 src/sys/arch/usermode/include/vmparam.h:1.16
--- src/sys/arch/usermode/include/vmparam.h:1.15	Tue Jan 10 10:19:38 2012
+++ src/sys/arch/usermode/include/vmparam.h	Wed Feb  8 17:55:21 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: vmparam.h,v 1.15 2012/01/10 10:19:38 reinoud Exp $ */
+/* $NetBSD: vmparam.h,v 1.16 2012/02/08 17:55:21 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -36,6 +36,7 @@
 
 extern paddr_t kmem_k_start, kmem_k_end;
 extern paddr_t kmem_kvm_start, kmem_kvm_end;
+extern paddr_t kmem_kvm_cur_end;
 extern paddr_t kmem_user_start, kmem_user_end;
 
 #define VM_MIN_ADDRESS		kmem_user_start

Index: src/sys/arch/usermode/usermode/machdep.c
diff -u src/sys/arch/usermode/usermode/machdep.c:1.52 src/sys/arch/usermode/usermode/machdep.c:1.53
--- src/sys/arch/usermode/usermode/machdep.c:1.52	Sun Jan 15 10:30:21 2012
+++ src/sys/arch/usermode/usermode/machdep.c	Wed Feb  8 17:55:21 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.52 2012/01/15 10:30:21 jmcneill Exp $ */
+/* $NetBSD: machdep.c,v 1.53 2012/02/08 17:55:21 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk 
@@ -37,7 +37,7 @@
 #include "opt_memsize.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.52 2012/01/15 10:30:21 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.53 2012/02/08 17:55:21 reinoud Exp $");
 
 #include 
 #include 
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -249,8 +250,30 @@ consinit(void)
 }
 
 int
-mm_md_physacc(paddr_t pa, vm_prot_t prog)
+mm_md_physacc(paddr_t pa, vm_prot_t prot)
 {
+	// printf("%s: pa = %p, acc %d\n", __func__, (void *) pa, prot);
+	if (pa >= physmem * PAGE_SIZE)
+		return EFAULT;
+	return 0;
+}
+
+
+int
+mm_md_kernacc(void *ptr, vm_prot_t prot, bool *handled)
+{
+	const vaddr_t va = (vaddr_t)ptr;
+	extern void *end;
+
+	// printf("%s: ptr %p, acc %d\n", __func__, ptr, prot);
+	if (va < kmem_kvm_start)
+		return EFAULT;
+	if ((va >= kmem_kvm_cur_end) && (va < kmem_k_start))
+		return EFAULT;
+	if (va > (vaddr_t) end)
+		return EFAULT;
+
+	*handled = true;
 	return 0;
 }
 



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

2012-02-08 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Feb  8 16:52:41 UTC 2012

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

Log Message:
Remove extra slash in makemandb.debug line.


To generate a diff of this commit:
cvs rdiff -u -r1.1731 -r1.1732 src/distrib/sets/lists/comp/mi

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1731 src/distrib/sets/lists/comp/mi:1.1732
--- src/distrib/sets/lists/comp/mi:1.1731	Tue Feb  7 19:13:25 2012
+++ src/distrib/sets/lists/comp/mi	Wed Feb  8 16:52:39 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1731 2012/02/07 19:13:25 joerg Exp $
+#	$NetBSD: mi,v 1.1732 2012/02/08 16:52:39 njoly Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4148,7 +4148,7 @@
 ./usr/libdata/debug/usr/sbin/lpd.debug		comp-lpr-debug		debug
 ./usr/libdata/debug/usr/sbin/lptest.debug	comp-lpr-debug		debug
 ./usr/libdata/debug/usr/sbin/mailwrapper.debug	comp-mailwrapper-debug	debug
-./usr/libdata/debug/usr/sbin//makemandb.debug	comp-makemandb-debug	makemandb,debug
+./usr/libdata/debug/usr/sbin/makemandb.debug	comp-makemandb-debug	makemandb,debug
 ./usr/libdata/debug/usr/sbin/makedbm.debug	comp-nis-debug		yp,debug
 ./usr/libdata/debug/usr/sbin/makefs.debug	comp-sysutil-debug	debug
 ./usr/libdata/debug/usr/sbin/map-mbone.debug	comp-netutil-debug	debug



CVS commit: src/distrib/sets

2012-02-08 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Feb  8 16:51:09 UTC 2012

Modified Files:
src/distrib/sets: getdirs.awk

Log Message:
Error out if a path has consecutive slashes which is unsupported and
made awk enter an infinite loop while creating set lists.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/distrib/sets/getdirs.awk

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/getdirs.awk
diff -u src/distrib/sets/getdirs.awk:1.4 src/distrib/sets/getdirs.awk:1.5
--- src/distrib/sets/getdirs.awk:1.4	Wed Apr 30 13:10:49 2008
+++ src/distrib/sets/getdirs.awk	Wed Feb  8 16:51:09 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: getdirs.awk,v 1.4 2008/04/30 13:10:49 martin Exp $
+#	$NetBSD: getdirs.awk,v 1.5 2012/02/08 16:51:09 njoly Exp $
 #
 # Copyright (c) 2002 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -50,6 +50,15 @@ function dirname(file) \
 	next
 }
 
+#	error if consecutive slashes are found
+#
+/\/\// \
+{
+	print "Unsupported consecutive slashes in path:" >"/dev/stderr"
+	print >"/dev/stderr"
+	exit 1
+}
+
 #	all other lines are parsed 
 #
 {



CVS commit: src/sys/dev/scsipi

2012-02-08 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Feb  8 12:22:00 UTC 2012

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

Log Message:
Convert uk(4) to device_t.  While here, clean up the code a bit.
releng ok (ack 3, nak 0, wait no more)


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/scsipi/uk.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/uk.c
diff -u src/sys/dev/scsipi/uk.c:1.59 src/sys/dev/scsipi/uk.c:1.60
--- src/sys/dev/scsipi/uk.c:1.59	Sun Dec  6 22:48:17 2009
+++ src/sys/dev/scsipi/uk.c	Wed Feb  8 12:22:00 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: uk.c,v 1.59 2009/12/06 22:48:17 dyoung Exp $	*/
+/*	$NetBSD: uk.c,v 1.60 2012/02/08 12:22:00 mbalmer Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uk.c,v 1.59 2009/12/06 22:48:17 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uk.c,v 1.60 2012/02/08 12:22:00 mbalmer Exp $");
 
 #include 
 #include 
@@ -50,10 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: uk.c,v 1.59 
 #include 
 #include 
 
-#define	UKUNIT(z)	(minor(z))
-
 struct uk_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 
 	struct scsipi_periph *sc_periph; /* all the inter level info */
 };
@@ -62,8 +60,14 @@ static int	ukmatch(device_t, cfdata_t, v
 static void	ukattach(device_t, device_t, void *);
 static int	ukdetach(device_t, int);
 
-
-CFATTACH_DECL(uk, sizeof(struct uk_softc), ukmatch, ukattach, ukdetach, NULL);
+CFATTACH_DECL_NEW(
+uk,
+sizeof(struct uk_softc),
+ukmatch,
+ukattach,
+ukdetach,
+NULL
+);
 
 extern struct cfdriver uk_cd;
 
@@ -77,11 +81,9 @@ const struct cdevsw uk_cdevsw = {
 };
 
 static int
-ukmatch(device_t parent, cfdata_t match,
-void *aux)
+ukmatch(device_t parent, cfdata_t match, void *aux)
 {
-
-	return (1);
+	return 1;
 }
 
 /*
@@ -96,12 +98,11 @@ ukattach(device_t parent, device_t self,
 	struct scsipi_periph *periph = sa->sa_periph;
 
 	SC_DEBUG(periph, SCSIPI_DB2, ("ukattach: "));
+	uk->sc_dev = self;
 
-	/*
-	 * Store information needed to contact our base driver
-	 */
+	/* Store information needed to contact our base driver */
 	uk->sc_periph = periph;
-	periph->periph_dev = &uk->sc_dev;
+	periph->periph_dev = uk->sc_dev;
 
 	printf("\n");
 }
@@ -109,7 +110,6 @@ ukattach(device_t parent, device_t self,
 static int
 ukdetach(device_t self, int flags)
 {
-	/*struct uk_softc *uk = device_private(self);*/
 	int cmaj, mn;
 
 	/* locate the major number */
@@ -119,12 +119,9 @@ ukdetach(device_t self, int flags)
 	mn = device_unit(self);
 	vdevgone(cmaj, mn, mn, VCHR);
 
-	return (0);
+	return 0;
 }
 
-/*
- * open the device.
- */
 static int
 ukopen(dev_t dev, int flag, int fmt, struct lwp *l)
 {
@@ -133,10 +130,10 @@ ukopen(dev_t dev, int flag, int fmt, str
 	struct scsipi_periph *periph;
 	struct scsipi_adapter *adapt;
 
-	unit = UKUNIT(dev);
+	unit = minor(dev);
 	uk = device_lookup_private(&uk_cd, unit);
 	if (uk == NULL)
-		return (ENXIO);
+		return ENXIO;
 
 	periph = uk->sc_periph;
 	adapt = periph->periph_channel->chan_adapter;
@@ -145,30 +142,24 @@ ukopen(dev_t dev, int flag, int fmt, str
 	("ukopen: dev=0x%"PRIx64" (unit %d (of %d))\n", dev, unit,
 		uk_cd.cd_ndevs));
 
-	/*
-	 * Only allow one at a time
-	 */
+	/* Only allow one at a time */
 	if (periph->periph_flags & PERIPH_OPEN) {
-		aprint_error_dev(&uk->sc_dev, "already open\n");
-		return (EBUSY);
+		aprint_error_dev(uk->sc_dev, "already open\n");
+		return EBUSY;
 	}
 
 	if ((error = scsipi_adapter_addref(adapt)) != 0)
-		return (error);
+		return error;
 	periph->periph_flags |= PERIPH_OPEN;
 
 	SC_DEBUG(periph, SCSIPI_DB3, ("open complete\n"));
-	return (0);
+	return 0;
 }
 
-/*
- * close the device.. only called if we are the LAST
- * occurence of an open device
- */
 static int
 ukclose(dev_t dev, int flag, int fmt, struct lwp *l)
 {
-	struct uk_softc *uk = device_lookup_private(&uk_cd, UKUNIT(dev));
+	struct uk_softc *uk = device_lookup_private(&uk_cd, minor(dev));
 	struct scsipi_periph *periph = uk->sc_periph;
 	struct scsipi_adapter *adapt = periph->periph_channel->chan_adapter;
 
@@ -179,17 +170,17 @@ ukclose(dev_t dev, int flag, int fmt, st
 	scsipi_adapter_delref(adapt);
 	periph->periph_flags &= ~PERIPH_OPEN;
 
-	return (0);
+	return 0;
 }
 
 /*
- * Perform special action on behalf of the user
+ * Perform special action on behalf of the user.
  * Only does generic scsi ioctls.
  */
 static int
 ukioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
 {
-	struct uk_softc *uk = device_lookup_private(&uk_cd, UKUNIT(dev));
+	struct uk_softc *uk = device_lookup_private(&uk_cd, minor(dev));
 
-	return (scsipi_do_ioctl(uk->sc_periph, dev, cmd, addr, flag, l));
+	return scsipi_do_ioctl(uk->sc_periph, dev, cmd, addr, flag, l);
 }



CVS commit: src/lib/libc/compat/gen

2012-02-08 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Feb  8 12:10:17 UTC 2012

Modified Files:
src/lib/libc/compat/gen: compat_readdir.c

Log Message:
Add missing cast, fixes i386 build.  releng ok.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/gen/compat_readdir.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/compat/gen/compat_readdir.c
diff -u src/lib/libc/compat/gen/compat_readdir.c:1.2 src/lib/libc/compat/gen/compat_readdir.c:1.3
--- src/lib/libc/compat/gen/compat_readdir.c:1.2	Wed Feb  8 03:24:30 2012
+++ src/lib/libc/compat/gen/compat_readdir.c	Wed Feb  8 12:10:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_readdir.c,v 1.2 2012/02/08 03:24:30 christos Exp $	*/
+/*	$NetBSD: compat_readdir.c,v 1.3 2012/02/08 12:10:17 mbalmer Exp $	*/
 
 #define __LIBC12_SOURCE__
 #include "namespace.h"
@@ -35,7 +35,7 @@ direnttodirent12(struct dirent12 *d12, c
 	d12->d_reclen = (uint16_t)d->d_reclen;
 	d12->d_namlen = (uint8_t)MIN(d->d_namlen, sizeof(d->d_name) - 1);
 	d12->d_type = (uint8_t)d->d_type;
-	memcpy(d12->d_name, d->d_name, d12->d_namlen);
+	memcpy(d12->d_name, d->d_name, (size_t)d12->d_namlen);
 	d12->d_name[d12->d_namlen] = '\0';
 	return d12;
 }



CVS commit: src/share/man/man9

2012-02-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Feb  8 09:32:47 UTC 2012

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

Log Message:
Bump date for previous, per mbalmer.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/share/man/man9/vnode.9

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

Modified files:

Index: src/share/man/man9/vnode.9
diff -u src/share/man/man9/vnode.9:1.55 src/share/man/man9/vnode.9:1.56
--- src/share/man/man9/vnode.9:1.55	Wed Feb  8 08:25:05 2012
+++ src/share/man/man9/vnode.9	Wed Feb  8 09:32:47 2012
@@ -1,4 +1,4 @@
-.\" $NetBSD: vnode.9,v 1.55 2012/02/08 08:25:05 wiz Exp $
+.\" $NetBSD: vnode.9,v 1.56 2012/02/08 09:32:47 wiz Exp $
 .\"
 .\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 14, 2011
+.Dd February 8, 2012
 .Dt VNODE 9
 .Os
 .Sh NAME



CVS commit: src/share/man/man9

2012-02-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Feb  8 08:25:05 UTC 2012

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

Log Message:
xref rwlock instead of deprecated lockmgr.
>From Julian Fagir in PR 45944.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/share/man/man9/vnode.9

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

Modified files:

Index: src/share/man/man9/vnode.9
diff -u src/share/man/man9/vnode.9:1.54 src/share/man/man9/vnode.9:1.55
--- src/share/man/man9/vnode.9:1.54	Tue Jun 14 07:49:09 2011
+++ src/share/man/man9/vnode.9	Wed Feb  8 08:25:05 2012
@@ -1,4 +1,4 @@
-.\" $NetBSD: vnode.9,v 1.54 2011/06/14 07:49:09 wiz Exp $
+.\" $NetBSD: vnode.9,v 1.55 2012/02/08 08:25:05 wiz Exp $
 .\"
 .\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -527,7 +527,7 @@ from the freelist, increment its referen
 The argument
 .Fa lockflags
 specifies the
-.Xr lockmgr 9
+.Xr rwlock 9
 flags used to lock the vnode.
 If the VXLOCK is set in
 .Fa vp Ns 's