CVS commit: src/sys/uvm
Module Name:src Committed By: chs Date: Fri Mar 30 02:25:24 UTC 2012 Modified Files: src/sys/uvm: uvm_amap.c Log Message: adjust amap_cow_now() to make UVM_PAGE_TRKOWN happy. To generate a diff of this commit: cvs rdiff -u -r1.105 -r1.106 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.105 src/sys/uvm/uvm_amap.c:1.106 --- src/sys/uvm/uvm_amap.c:1.105 Fri Jan 27 19:48:41 2012 +++ src/sys/uvm/uvm_amap.c Fri Mar 30 02:25:24 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_amap.c,v 1.105 2012/01/27 19:48:41 para Exp $ */ +/* $NetBSD: uvm_amap.c,v 1.106 2012/03/30 02:25:24 chs Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.105 2012/01/27 19:48:41 para Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.106 2012/03/30 02:25:24 chs Exp $"); #include "opt_uvmhist.h" @@ -1035,6 +1035,7 @@ ReStart: nanon = uvm_analloc(); if (nanon) { + nanon->an_lock = amap->am_lock; npg = uvm_pagealloc(NULL, 0, nanon, 0); } else { npg = NULL; @@ -1042,6 +1043,7 @@ ReStart: if (nanon == NULL || npg == NULL) { amap_unlock(amap); if (nanon) { +nanon->an_lock = NULL; nanon->an_ref--; KASSERT(nanon->an_ref == 0); uvm_anon_free(nanon); @@ -1055,7 +1057,6 @@ ReStart: * Also, setup its lock (share the with amap's lock). */ - nanon->an_lock = amap->am_lock; uvm_pagecopy(pg, npg); anon->an_ref--; KASSERT(anon->an_ref > 0);
CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi
Module Name:src Committed By: matt Date: Fri Mar 30 01:04:48 UTC 2012 Modified Files: src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_fmn.c Log Message: Deal with station ids without names (not all XLS have all stations). To generate a diff of this commit: cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/arch/mips/rmi/rmixl_fmn.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/rmi/rmixl_fmn.c diff -u src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.11 src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.12 --- src/sys/arch/mips/rmi/rmixl_fmn.c:1.1.2.11 Thu Jan 19 10:29:34 2012 +++ src/sys/arch/mips/rmi/rmixl_fmn.c Fri Mar 30 01:04:47 2012 @@ -790,8 +790,10 @@ rmixl_fmn_cpu_attach(struct cpu_info *ci KASSERT(xname != NULL); for (size_t i = 1; i < fmn_info.fmn_nstid; i++) { - evcnt_attach_dynamic(&sc->sc_fmn_stid_evcnts[i], - EVCNT_TYPE_MISC, NULL, xname, fmn_stid_ev_names[i]); + if (fmn_stid_ev_names[i][0] != '\0') { + evcnt_attach_dynamic(&sc->sc_fmn_stid_evcnts[i], + EVCNT_TYPE_MISC, NULL, xname, fmn_stid_ev_names[i]); + } } for (size_t i = 0; i < fmn_info.fmn_nbucket; i++) { @@ -811,9 +813,11 @@ rmixl_fmn_init_thread(void) KASSERT(fmn->fmn_stinfo[0].si_name == NULL); for (size_t i = 1; i < fmn_info.fmn_nstid; i++) { - KASSERT(fmn->fmn_stinfo[i].si_name != NULL); - snprintf(fmn_stid_ev_names[i], sizeof(fmn_stid_ev_names[i]), - "fmn %s rx msgs", fmn->fmn_stinfo[i].si_name); + if (fmn->fmn_stinfo[i].si_name != NULL) { + snprintf(fmn_stid_ev_names[i], + sizeof(fmn_stid_ev_names[i]), + "fmn %s rx msgs", fmn->fmn_stinfo[i].si_name); + } } if (CPU_IS_PRIMARY(ci)) {
CVS commit: src/sys/arch/hppa/include
Module Name:src Committed By: skrll Date: Thu Mar 29 21:44:10 UTC 2012 Modified Files: src/sys/arch/hppa/include: psl.h Log Message: Remove unnecessary #include To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hppa/include/psl.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/psl.h diff -u src/sys/arch/hppa/include/psl.h:1.7 src/sys/arch/hppa/include/psl.h:1.8 --- src/sys/arch/hppa/include/psl.h:1.7 Tue Nov 3 05:07:26 2009 +++ src/sys/arch/hppa/include/psl.h Thu Mar 29 21:44:10 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: psl.h,v 1.7 2009/11/03 05:07:26 snj Exp $ */ +/* $NetBSD: psl.h,v 1.8 2012/03/29 21:44:10 skrll Exp $ */ /* $OpenBSD: psl.h,v 1.6 1999/11/25 18:29:01 mickey Exp $ */ @@ -106,8 +106,4 @@ #define PSW_MBS (PSW_C | PSW_Q | PSW_P | PSW_D | PSW_I) #define PSW_MBZ (PSW_Y | PSW_Z | PSW_S | PSW_X | PSW_M | PSW_R) -#ifdef _KERNEL -#include -#endif - #endif /* _HPPA_PSL_H_ */
CVS commit: src/lib/libc/arch/mips/gen
Module Name:src Committed By: christos Date: Thu Mar 29 21:21:04 UTC 2012 Modified Files: src/lib/libc/arch/mips/gen: cacheflush.c Log Message: nbytes is now size_t To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/mips/gen/cacheflush.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/mips/gen/cacheflush.c diff -u src/lib/libc/arch/mips/gen/cacheflush.c:1.5 src/lib/libc/arch/mips/gen/cacheflush.c:1.6 --- src/lib/libc/arch/mips/gen/cacheflush.c:1.5 Thu Mar 29 15:26:21 2012 +++ src/lib/libc/arch/mips/gen/cacheflush.c Thu Mar 29 17:21:04 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cacheflush.c,v 1.5 2012/03/29 19:26:21 christos Exp $ */ +/* $NetBSD: cacheflush.c,v 1.6 2012/03/29 21:21:04 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include int -_cacheflush(void *addr, int nbytes, int whichcache) +_cacheflush(void *addr, size_t nbytes, int whichcache) { struct mips_cacheflush_args cfa;
CVS commit: src/sys/arch/mips/include
Module Name:src Committed By: christos Date: Thu Mar 29 21:20:08 UTC 2012 Modified Files: src/sys/arch/mips/include: cachectl.h Log Message: - elide parameter tags - make argument size_t as appropriate - add begin/end decls To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/include/cachectl.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/mips/include/cachectl.h diff -u src/sys/arch/mips/include/cachectl.h:1.9 src/sys/arch/mips/include/cachectl.h:1.10 --- src/sys/arch/mips/include/cachectl.h:1.9 Sat Mar 14 10:46:02 2009 +++ src/sys/arch/mips/include/cachectl.h Thu Mar 29 17:20:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cachectl.h,v 1.9 2009/03/14 14:46:02 dsl Exp $ */ +/* $NetBSD: cachectl.h,v 1.10 2012/03/29 21:20:08 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -34,11 +34,12 @@ #include +__BEGIN_DECLS /* * invalidate a range of addresses from the cache. */ -int _cacheflush(void *addr, int nbytes, int cacheflags); -int cacheflush(void *addr, int nbytes, int cacheflags); +int _cacheflush(void *, size_t, int); +int cacheflush(void *, size_t, int); /* cacheflush() flags: */ #define ICACHE 0x01 /* invalidate I-cache */ @@ -46,12 +47,14 @@ int cacheflush(void *addr, int nbytes, #define BCACHE (ICACHE|DCACHE) /* invalidate both caches, as above */ -int cachectl(void *addr, int nbytes, int cacheop); +int cachectl(void *, size_t, int); /* cachectl() cache operations: */ #define CACHEABLE 0x00 /* make page(s) cacheable */ #define UNCACHEABLE 0x01 /* make page(s) uncacheable */ +__END_DECLS + #ifdef _KERNEL int mips_user_cachectl(struct proc *, vaddr_t, size_t, int); int mips_user_cacheflush(struct proc *, vaddr_t, size_t, int);
CVS commit: src/sys/arch/hppa/hppa
Module Name:src Committed By: skrll Date: Thu Mar 29 20:31:49 UTC 2012 Modified Files: src/sys/arch/hppa/hppa: db_machdep.c Log Message: Use PSW_BITS to decode the bits of the PSW in db_dump_trap To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/hppa/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/hppa/hppa/db_machdep.c diff -u src/sys/arch/hppa/hppa/db_machdep.c:1.5 src/sys/arch/hppa/hppa/db_machdep.c:1.6 --- src/sys/arch/hppa/hppa/db_machdep.c:1.5 Wed Jan 18 09:35:48 2012 +++ src/sys/arch/hppa/hppa/db_machdep.c Thu Mar 29 20:31:49 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.5 2012/01/18 09:35:48 skrll Exp $ */ +/* $NetBSD: db_machdep.c,v 1.6 2012/03/29 20:31:49 skrll Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.5 2012/01/18 09:35:48 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.6 2012/03/29 20:31:49 skrll Exp $"); #include #include @@ -130,6 +130,7 @@ db_dump_trap(db_expr_t addr, bool have_a const char *cp = modif; bool lwpaddr = false; char c; + char buf[64]; tf = DDB_REGS; while ((c = *cp++) != 0) { @@ -186,7 +187,9 @@ db_dump_trap(db_expr_t addr, bool have_a db_printf("\n"); db_printf("Other state\n"); db_printf("eiem: %08x\n", tf->tf_eiem); - db_printf("ipsw: %08x\n", tf->tf_ipsw); + + snprintb(buf, sizeof(buf), PSW_BITS, tf->tf_ipsw); + db_printf("ipsw: %s\n", buf); db_printf("flags: %08x\n", tf->tf_flags); db_printf("sar:%08x\n", tf->tf_sar); db_printf("pidr1: %08x\n", tf->tf_pidr1); /* cr8 */
CVS commit: src/lib/libc/arch/mips/gen
Module Name:src Committed By: christos Date: Thu Mar 29 19:27:05 UTC 2012 Modified Files: src/lib/libc/arch/mips/gen: longjmp.c Log Message: make constant explicitly unsigned To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/mips/gen/longjmp.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/mips/gen/longjmp.c diff -u src/lib/libc/arch/mips/gen/longjmp.c:1.4 src/lib/libc/arch/mips/gen/longjmp.c:1.5 --- src/lib/libc/arch/mips/gen/longjmp.c:1.4 Fri Sep 3 13:22:51 2010 +++ src/lib/libc/arch/mips/gen/longjmp.c Thu Mar 29 15:27:05 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: longjmp.c,v 1.4 2010/09/03 17:22:51 matt Exp $ */ +/* $NetBSD: longjmp.c,v 1.5 2012/03/29 19:27:05 christos Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -49,7 +49,7 @@ __longjmp14(jmp_buf env, int val) ucontext_t uc; /* Ensure non-zero SP and sigcontext magic number is present */ - if (sc->sc_regs[_R_SP] == 0 || sc->sc_regs[_R_ZERO] != (mips_reg_t)0xACEDBADE) + if (sc->sc_regs[_R_SP] == 0 || sc->sc_regs[_R_ZERO] != (mips_reg_t)0xACEDBADEU) goto err; /* Ensure non-zero return value */
CVS commit: src/lib/libc/arch/mips/gen
Module Name:src Committed By: christos Date: Thu Mar 29 19:26:21 UTC 2012 Modified Files: src/lib/libc/arch/mips/gen: cacheflush.c Log Message: fix lint, should nbytes be changed to size_t to match with the struct passed? To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/mips/gen/cacheflush.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/mips/gen/cacheflush.c diff -u src/lib/libc/arch/mips/gen/cacheflush.c:1.4 src/lib/libc/arch/mips/gen/cacheflush.c:1.5 --- src/lib/libc/arch/mips/gen/cacheflush.c:1.4 Mon Apr 28 16:22:56 2008 +++ src/lib/libc/arch/mips/gen/cacheflush.c Thu Mar 29 15:26:21 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cacheflush.c,v 1.4 2008/04/28 20:22:56 martin Exp $ */ +/* $NetBSD: cacheflush.c,v 1.5 2012/03/29 19:26:21 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -34,14 +34,12 @@ #include int -_cacheflush(addr, nbytes, whichcache) - void * addr; - int nbytes, whichcache; +_cacheflush(void *addr, int nbytes, int whichcache) { struct mips_cacheflush_args cfa; - cfa.va = (vaddr_t) addr; + cfa.va = (vaddr_t)(intptr_t)addr; cfa.nbytes = nbytes; cfa.whichcache = whichcache; - return (sysarch(MIPS_CACHEFLUSH, (void *)&cfa)); + return sysarch(MIPS_CACHEFLUSH, (void *)&cfa); }
CVS commit: src/usr.sbin/rtadvd
Module Name:src Committed By: wiz Date: Thu Mar 29 18:37:46 UTC 2012 Modified Files: src/usr.sbin/rtadvd: rtadvd.conf.5 Log Message: - improve wording; - replace references to resolver(5) with ones to resolv.conf(5); - remove references to FreeBSD (which were copied 1:1 from their man page). >From patch by Bug Hunting. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/rtadvd/rtadvd.conf.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/rtadvd/rtadvd.conf.5 diff -u src/usr.sbin/rtadvd/rtadvd.conf.5:1.15 src/usr.sbin/rtadvd/rtadvd.conf.5:1.16 --- src/usr.sbin/rtadvd/rtadvd.conf.5:1.15 Sat Dec 10 19:14:29 2011 +++ src/usr.sbin/rtadvd/rtadvd.conf.5 Thu Mar 29 18:37:45 2012 @@ -1,4 +1,4 @@ -.\" $NetBSD: rtadvd.conf.5,v 1.15 2011/12/10 19:14:29 roy Exp $ +.\" $NetBSD: rtadvd.conf.5,v 1.16 2012/03/29 18:37:45 wiz Exp $ .\" $KAME: rtadvd.conf.5,v 1.50 2005/01/14 05:30:59 jinmei Exp $ .\" .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -356,10 +356,9 @@ options with corresponding .Cm rdnssltime2 ... entries. Note that the maximum number of servers depends on the receiver side. -See also -.Xr resolver 5 -manual page for resolver implementation in -.Fx . +See also the +.Xr resolv.conf 5 +manual page for the resolver implementation. .It Cm \&rdnssltime The lifetime of the .Cm rdnss @@ -382,10 +381,9 @@ options with corresponding .Cm dnsslltime2 ... entries. Note that the maximum number of names depends on the receiver side. -See also -.Xr resolver 5 -manual page for resolver implementation in -.Fx . +See also the +.Xr resolv.conf 5 +manual page for the resolver implementation. .It Cm \&dnsslltime The lifetime of the .Cm dnssl
CVS commit: src/share/man/man7
Module Name:src Committed By: wiz Date: Thu Mar 29 18:37:22 UTC 2012 Modified Files: src/share/man/man7: hostname.7 Log Message: Replace references to resolver(5) with ones to resolv.conf(5). >From patch by Bug Hunting. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/share/man/man7/hostname.7 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/man7/hostname.7 diff -u src/share/man/man7/hostname.7:1.12 src/share/man/man7/hostname.7:1.13 --- src/share/man/man7/hostname.7:1.12 Thu Mar 22 07:58:18 2012 +++ src/share/man/man7/hostname.7 Thu Mar 29 18:37:21 2012 @@ -1,4 +1,4 @@ -.\" $NetBSD: hostname.7,v 1.12 2012/03/22 07:58:18 wiz Exp $ +.\" $NetBSD: hostname.7,v 1.13 2012/03/29 18:37:21 wiz Exp $ .\" .\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") .\" @@ -156,7 +156,7 @@ and options are present in the resolver configuration file, then only the .Em last one listed is used (see -.Xr resolver 5 ) . +.Xr resolv.conf 5 ) . .Pp If the name was not previously tried .Dq as-is @@ -177,9 +177,9 @@ pairs. .Bl -tag -width "/etc/resolv.conf " -compact .It Pa /etc/resolv.conf See -.Xr resolver 5 . +.Xr resolv.conf 5 . .El .Sh SEE ALSO .Xr gethostbyname 3 , -.Xr resolver 5 , +.Xr resolv.conf 5 , .Xr mailaddr 7
CVS commit: src/compat
Module Name:src Committed By: wiz Date: Thu Mar 29 18:35:11 UTC 2012 Modified Files: src/compat: README Log Message: Fix typos; wording. >From patch by Bug Hunting. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/compat/README Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/compat/README diff -u src/compat/README:1.7 src/compat/README:1.8 --- src/compat/README:1.7 Sun Apr 17 01:29:06 2011 +++ src/compat/README Thu Mar 29 18:35:11 2012 @@ -1,7 +1,7 @@ -$NetBSD: README,v 1.7 2011/04/17 01:29:06 mrg Exp $ +$NetBSD: README,v 1.8 2012/03/29 18:35:11 wiz Exp $ -Building multi- ABI libraries for NetBSD platforms. +Building multi-ABI libraries for NetBSD platforms. src/compat has a framework to (re)build the libraries shipped with @@ -15,11 +15,11 @@ The basic premise is to re-set $MAKEOBJD underneath src/compat and rebuild the libraries with a different set of options. Each platform wanting support should create their port subdirectory directly in src/compat, and then one subdirectory in here -for each ABI required. e.g., src/compat/amd64/i386 is where we build +for each ABI required, e.g., src/compat/amd64/i386 is where we build the 32-bit compat libraries for the amd64 port. In each of these -subdirs, a small Makefile and makefile fragment should exist. The +subdirectories, a small Makefile and makefile fragment should exist. The Makefile should set BSD_MK_COMPAT_FILE to equal the fragment, and then -include "../../compatsubdir.mk" Eg, amd64/i386/Makefile has: +include "../../compatsubdir.mk". E.g., amd64/i386/Makefile has: BSD_MK_COMPAT_FILE=${.CURDIR}/bsd.i386.mk @@ -60,7 +60,7 @@ ld.elf_so) to build with this ABI. archdirs.mk holds the list of subdirectories for each port. Makefile.compat has the basic framework to force the right paths for -library and ld.elf_so linkage. It contains a hack to create subdirs +library and ld.elf_so linkage. It contains a hack to create subdirectories in the build that should be fixed. dirshack/Makefile is a hack to get objdirs created timely, and should
CVS commit: src/usr.bin/nohup
Module Name:src Committed By: wiz Date: Thu Mar 29 18:33:20 UTC 2012 Modified Files: src/usr.bin/nohup: nohup.1 Log Message: Punctuation. >From patch by Bug Hunting. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/usr.bin/nohup/nohup.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/nohup/nohup.1 diff -u src/usr.bin/nohup/nohup.1:1.14 src/usr.bin/nohup/nohup.1:1.15 --- src/usr.bin/nohup/nohup.1:1.14 Fri May 14 17:28:56 2010 +++ src/usr.bin/nohup/nohup.1 Thu Mar 29 18:33:19 2012 @@ -1,4 +1,4 @@ -.\" $NetBSD: nohup.1,v 1.14 2010/05/14 17:28:56 joerg Exp $ +.\" $NetBSD: nohup.1,v 1.15 2012/03/29 18:33:19 wiz Exp $ .\" .\" Copyright (c) 1989, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -80,7 +80,7 @@ will exit without invoking with an exit value as described below. .Sh ENVIRONMENT The following variable is used by -.Nm . +.Nm : .Bl -tag -width flag .It Ev HOME User's home directory.
CVS commit: src/sys/arch/evbppc/mpc85xx
Module Name:src Committed By: matt Date: Thu Mar 29 15:49:08 UTC 2012 Modified Files: src/sys/arch/evbppc/mpc85xx: machdep.c Log Message: Add support for PMAP_MINIMALTLB. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbppc/mpc85xx/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/evbppc/mpc85xx/machdep.c diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.22 src/sys/arch/evbppc/mpc85xx/machdep.c:1.23 --- src/sys/arch/evbppc/mpc85xx/machdep.c:1.22 Fri Jan 27 18:52:54 2012 +++ src/sys/arch/evbppc/mpc85xx/machdep.c Thu Mar 29 15:49:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.22 2012/01/27 18:52:54 para Exp $ */ +/* $NetBSD: machdep.c,v 1.23 2012/03/29 15:49:08 matt Exp $ */ /*- * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -1126,44 +1126,20 @@ initppc(vaddr_t startkernel, vaddr_t end /* * Initialize the pmap. */ - pmap_bootstrap(startkernel, endkernel, availmemr, nmemr); + endkernel = pmap_bootstrap(startkernel, endkernel, availmemr, nmemr); /* * Let's take all the indirect calls via our stubs and patch * them to be direct calls. */ cpu_fixup_stubs(); -#if 0 + /* * As a debug measure we can change the TLB entry that maps all of * memory to one that encompasses the 64KB with the kernel vectors. * All other pages will be soft faulted into the TLB as needed. */ - const uint32_t saved_mas0 = mfspr(SPR_MAS0); - mtspr(SPR_MAS6, 0); - __asm volatile("tlbsx\t0, %0" :: "b"(startkernel)); - uint32_t mas0 = mfspr(SPR_MAS0); - uint32_t mas1 = mfspr(SPR_MAS1); - uint32_t mas2 = mfspr(SPR_MAS2); - uint32_t mas3 = mfspr(SPR_MAS3); - KASSERT(mas3 & MAS3_SW); - KASSERT(mas3 & MAS3_SR); - KASSERT(mas3 & MAS3_SX); - mas1 = (mas1 & ~MAS1_TSIZE) | MASX_TSIZE_64KB; - pt_entry_t xpn_mask = ~0 << (10 + 2 * MASX_TSIZE_GET(mas1)); - mas2 = (mas2 & ~(MAS2_EPN)) | (startkernel & xpn_mask); - mas3 = (mas3 & ~(MAS3_RPN|MAS3_SW)) | (startkernel & xpn_mask); - printf(" %#lx=<%#x,%#x,%#x,%#x>", startkernel, mas0, mas1, mas2, mas3); -#if 1 - mtspr(SPR_MAS1, mas1); - mtspr(SPR_MAS2, mas2); - mtspr(SPR_MAS3, mas3); - extern void tlbwe(void); - tlbwe(); - mtspr(SPR_MAS0, saved_mas0); - printf("(ok)"); -#endif -#endif + e500_tlb_minimize(endkernel); /* * Set some more MD helpers
CVS commit: src/sys/arch/powerpc/booke
Module Name:src Committed By: matt Date: Thu Mar 29 15:48:20 UTC 2012 Modified Files: src/sys/arch/powerpc/booke: booke_pmap.c e500_tlb.c Log Message: Add support PMAP_MINIMALTLB option. This changes the default use of TLB1 entries to map all of physical memory to using two TLB1 entries, one for mapping text and one for data. The rest of memory is mapped using the page table which is updated as needed. This is used to trap memory corruption issues. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/powerpc/booke/booke_pmap.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/booke/e500_tlb.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/booke/booke_pmap.c diff -u src/sys/arch/powerpc/booke/booke_pmap.c:1.12 src/sys/arch/powerpc/booke/booke_pmap.c:1.13 --- src/sys/arch/powerpc/booke/booke_pmap.c:1.12 Thu Feb 2 18:59:44 2012 +++ src/sys/arch/powerpc/booke/booke_pmap.c Thu Mar 29 15:48:20 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: booke_pmap.c,v 1.12 2012/02/02 18:59:44 para Exp $ */ +/* $NetBSD: booke_pmap.c,v 1.13 2012/03/29 15:48:20 matt Exp $ */ /*- * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -38,7 +38,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.12 2012/02/02 18:59:44 para Exp $"); +__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.13 2012/03/29 15:48:20 matt Exp $"); #include #include @@ -59,6 +59,8 @@ __KERNEL_RCSID(0, "$NetBSD: booke_pmap.c CTASSERT(sizeof(struct pmap_segtab) == NBPG); +struct pmap_segtab pmap_kernel_segtab; + void pmap_procwr(struct proc *p, vaddr_t va, size_t len) { @@ -120,30 +122,46 @@ pmap_md_direct_mapped_vaddr_to_paddr(vad return (paddr_t) va; } +#ifdef PMAP_MINIMALTLB +static pt_entry_t * +kvtopte(const struct pmap_segtab *stp, vaddr_t va) +{ + pt_entry_t * const ptep = stp->seg_tab[va >> SEGSHIFT]; + if (ptep == NULL) + return NULL; + return &ptep[(va & SEGOFSET) >> PAGE_SHIFT]; +} + +vaddr_t +pmap_kvptefill(vaddr_t sva, vaddr_t eva, pt_entry_t pt_entry) +{ + const struct pmap_segtab * const stp = pmap_kernel()->pm_segtab; + KASSERT(sva == trunc_page(sva)); + pt_entry_t *ptep = kvtopte(stp, sva); + for (; sva < eva; sva += NBPG) { + *ptep++ = pt_entry ? (sva | pt_entry) : 0; + } + return sva; +} +#endif + /* * Bootstrap the system enough to run with virtual memory. * firstaddr is the first unused kseg0 address (not page aligned). */ -void +vaddr_t pmap_bootstrap(vaddr_t startkernel, vaddr_t endkernel, - const phys_ram_seg_t *avail, size_t cnt) + phys_ram_seg_t *avail, size_t cnt) { - for (size_t i = 0; i < cnt; i++) { - printf(" uvm_page_physload(%#lx,%#lx,%#lx,%#lx,%d)", - atop(avail[i].start), - atop(avail[i].start + avail[i].size) - 1, - atop(avail[i].start), - atop(avail[i].start + avail[i].size) - 1, - VM_FREELIST_DEFAULT); - uvm_page_physload( - atop(avail[i].start), - atop(avail[i].start + avail[i].size) - 1, - atop(avail[i].start), - atop(avail[i].start + avail[i].size) - 1, - VM_FREELIST_DEFAULT); - } + struct pmap_segtab * const stp = &pmap_kernel_segtab; + + /* + * Initialize the kernel segment table. + */ + pmap_kernel()->pm_segtab = stp; + curcpu()->ci_pmap_kern_segtab = stp; - pmap_tlb_info_init(&pmap_tlb0_info); /* init the lock */ + KASSERT(endkernel == trunc_page(endkernel)); /* * Compute the number of pages kmem_arena will have. @@ -160,7 +178,7 @@ pmap_bootstrap(vaddr_t startkernel, vadd vsize_t bufsz = buf_memcalc(); buf_setvalimit(bufsz); - vsize_t nsegtabs = pmap_round_seg(VM_PHYS_SIZE + vsize_t kv_nsegtabs = pmap_round_seg(VM_PHYS_SIZE + (ubc_nwins << ubc_winshift) + bufsz + 16 * NCARGS @@ -169,7 +187,7 @@ pmap_bootstrap(vaddr_t startkernel, vadd #ifdef SYSVSHM + NBPG * shminfo.shmall #endif - + NBPG * nkmempages); + + NBPG * nkmempages) >> SEGSHIFT; /* * Initialize `FYI' variables. Note we're relying on @@ -179,68 +197,100 @@ pmap_bootstrap(vaddr_t startkernel, vadd */ pmap_limits.avail_start = vm_physmem[0].start << PGSHIFT; pmap_limits.avail_end = vm_physmem[vm_nphysseg - 1].end << PGSHIFT; - const vsize_t max_nsegtabs = + const size_t max_nsegtabs = (pmap_round_seg(VM_MAX_KERNEL_ADDRESS) - pmap_trunc_seg(VM_MIN_KERNEL_ADDRESS)) / NBSEG; - if (nsegtabs >= max_nsegtabs) { + if (kv_nsegtabs >= max_nsegtabs) { pmap_limits.virtual_end = VM_MAX_KERNEL_ADDRESS; - nsegtabs = max_nsegtabs; + kv_nsegtabs = max_nsegtabs; } else { pmap_limits.virtual_end = VM_MIN_KERNEL_ADDRESS - + nsegtabs * NBSEG; + + kv_nsegtabs * NBSEG; } - pmap_pvlist_lock_init(curcpu()->ci_ci.dcache_line_size); - /* * Now actually allocate the kernel PTE array (must be done * after virtual_end is initialized). */ - vaddr_t segtabs = - uvm_pageboot_alloc(NBPG * nsegtabs + sizeof(struct pma
CVS commit: src/sys/arch/powerpc/include/booke
Module Name:src Committed By: matt Date: Thu Mar 29 15:45:06 UTC 2012 Modified Files: src/sys/arch/powerpc/include/booke: e500var.h Log Message: Add e500_tlb_minimize prototype. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/powerpc/include/booke/e500var.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/booke/e500var.h diff -u src/sys/arch/powerpc/include/booke/e500var.h:1.4 src/sys/arch/powerpc/include/booke/e500var.h:1.5 --- src/sys/arch/powerpc/include/booke/e500var.h:1.4 Wed Jun 29 06:01:33 2011 +++ src/sys/arch/powerpc/include/booke/e500var.h Thu Mar 29 15:45:06 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: e500var.h,v 1.4 2011/06/29 06:01:33 matt Exp $ */ +/* $NetBSD: e500var.h,v 1.5 2012/03/29 15:45:06 matt Exp $ */ /*- * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -55,6 +55,7 @@ void e500_device_register(device_t, void int e500_clock_intr(void *); void e500_cpu_start(void); void e500_tlb_init(vaddr_t, psize_t); +void e500_tlb_minimize(vaddr_t); bool e500_device_disabled_p(uint32_t); struct e500_truthtab {
CVS commit: src/sys/arch/powerpc/include/booke
Module Name:src Committed By: matt Date: Thu Mar 29 15:44:40 UTC 2012 Modified Files: src/sys/arch/powerpc/include/booke: pmap.h Log Message: Add vsize_t to pmap_md_{un,}map_poolpage. Add pmap_kvptefill prototype. Slightly change pmap_bootstrap prototype. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/include/booke/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/powerpc/include/booke/pmap.h diff -u src/sys/arch/powerpc/include/booke/pmap.h:1.8 src/sys/arch/powerpc/include/booke/pmap.h:1.9 --- src/sys/arch/powerpc/include/booke/pmap.h:1.8 Thu Jun 30 00:52:59 2011 +++ src/sys/arch/powerpc/include/booke/pmap.h Thu Mar 29 15:44:40 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.8 2011/06/30 00:52:59 matt Exp $ */ +/* $NetBSD: pmap.h,v 1.9 2012/03/29 15:44:40 matt Exp $ */ /*- * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -44,6 +44,10 @@ #error this file should not be included by loadable kernel modules #endif +#ifdef _KERNEL_OPT +#include "opt_pmap.h" +#endif + #include #include #include @@ -77,7 +81,8 @@ void pmap_procwr(struct proc *, vaddr_t, #ifdef __PMAP_PRIVATE struct vm_page * pmap_md_alloc_poolpage(int flags); -vaddr_t pmap_md_map_poolpage(paddr_t); +vaddr_t pmap_md_map_poolpage(paddr_t, vsize_t); +void pmap_md_unmap_poolpage(vaddr_t, vsize_t); bool pmap_md_direct_mapped_vaddr_p(vaddr_t); bool pmap_md_io_vaddr_p(vaddr_t); paddr_t pmap_md_direct_mapped_vaddr_to_paddr(vaddr_t); @@ -85,10 +90,14 @@ vaddr_t pmap_md_direct_map_paddr(paddr_t void pmap_md_init(void); bool pmap_md_tlb_check_entry(void *, vaddr_t, tlb_asid_t, pt_entry_t); + +#ifdef PMAP_MINIMALTLB +vaddr_t pmap_kvptefill(vaddr_t, vaddr_t, pt_entry_t); +#endif #endif void pmap_md_page_syncicache(struct vm_page *, __cpuset_t); -void pmap_bootstrap(vaddr_t, vaddr_t, const phys_ram_seg_t *, size_t); +vaddr_t pmap_bootstrap(vaddr_t, vaddr_t, phys_ram_seg_t *, size_t); bool pmap_extract(struct pmap *, vaddr_t, paddr_t *); static inline paddr_t vtophys(vaddr_t);
CVS commit: src/sys/arch/powerpc/conf
Module Name:src Committed By: matt Date: Thu Mar 29 15:42:59 UTC 2012 Modified Files: src/sys/arch/powerpc/conf: files.powerpc Log Message: Add PMAP_MINIMALTLB defflag To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/sys/arch/powerpc/conf/files.powerpc 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/conf/files.powerpc diff -u src/sys/arch/powerpc/conf/files.powerpc:1.82 src/sys/arch/powerpc/conf/files.powerpc:1.83 --- src/sys/arch/powerpc/conf/files.powerpc:1.82 Wed Jun 29 06:02:43 2011 +++ src/sys/arch/powerpc/conf/files.powerpc Thu Mar 29 15:42:59 2012 @@ -1,10 +1,10 @@ -# $NetBSD: files.powerpc,v 1.82 2011/06/29 06:02:43 matt Exp $ +# $NetBSD: files.powerpc,v 1.83 2012/03/29 15:42:59 matt Exp $ defflag opt_altivec.h ALTIVEC K_ALTIVEC PPC_HAVE_SPE defflag opt_openpic.h OPENPIC OPENPIC_SERIAL_MODE OPENPIC_DISTRIBUTE defparam opt_ppcparam.h L2CR_CONFIG L3CR_CONFIG INTSTK CLOCKBASE VERBOSE_INITPPC defflag opt_ppcarch.h PPC_OEA PPC_OEA601 PPC_OEA64 PPC_OEA64_BRIDGE PPC_MPC8XX PPC_IBM4XX PPC_IBM403 PPC_BOOKE -defflag opt_pmap.h PMAPDEBUG PMAPCHECK PMAPCOUNTERS +defflag opt_pmap.h PMAPDEBUG PMAPCHECK PMAPCOUNTERS PMAP_MINIMALTLB defparam opt_pmap.h PTEGCOUNT PMAP_MEMLIMIT file arch/powerpc/powerpc/copystr.c
CVS commit: src/sys/arch/powerpc/conf
Module Name:src Committed By: matt Date: Thu Mar 29 15:42:16 UTC 2012 Added Files: src/sys/arch/powerpc/conf: kern-mb.ldscript Log Message: Add ldscript which aligns .data to a 1MB boundary. (used for testing) To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/powerpc/conf/kern-mb.ldscript Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/powerpc/conf/kern-mb.ldscript diff -u /dev/null src/sys/arch/powerpc/conf/kern-mb.ldscript:1.1 --- /dev/null Thu Mar 29 15:42:16 2012 +++ src/sys/arch/powerpc/conf/kern-mb.ldscript Thu Mar 29 15:42:15 2012 @@ -0,0 +1,76 @@ +/* $NetBSD: kern-mb.ldscript,v 1.1 2012/03/29 15:42:15 matt Exp $ */ + +/* ldscript for NetBSD/powerpc kernels and LKMs */ +OUTPUT_ARCH(powerpc) +ENTRY(_start) +SEARCH_DIR(/lib); +/* Do we need any of these? + __DYNAMIC = 0;*/ +_DYNAMIC_LINK = 0; +SECTIONS +{ + /* Read-only sections, merged into text segment. Assumes the + kernel Makefile sets the start address via -Ttext. */ + .text : + { +_ftext = . ; +*(.text) +__stub_start = .; +*(.stub) +__stub_end = .; +__stub_pmap_start = .; +*(.stub.pmap) +__stub_pmap_end = .; +*(.gnu.warning) + } =0 + _etext = .; + PROVIDE (etext = .); + .rodata: { *(.rodata) *(.rodata.*) } + .reginfo : { *(.reginfo) } + . = ALIGN(0x10); + .data: + { +_fdata = . ; +*(.data) +CONSTRUCTORS + } + .data1 : { *(.data1) } + . = ALIGN(32); /* COHERENCY UNIT */ + .data.cacheline_aligned : { *(.data.cacheline_aligned) } + . = ALIGN(32); /* COHERENCY UNIT */ + .data.read_mostly : { *(.data.read_mostly) } + . = ALIGN(32); /* COHERENCY UNIT */ + _gp = ALIGN(16) + 0x7ff0; + .lit8 : { *(.lit8) } + .lit4 : { *(.lit4) } + .sdata : { *(.sdata) } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + _fbss = .; + .sbss : { *(.sbss) *(.scommon) } + .bss : + { + *(.bss) + *(COMMON) + } + _end = . ; + PROVIDE (end = .); + /* These are needed for ELF backends which have not yet been + converted to the new style linker. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + /* DWARF debug sections. + Symbols in the .debug DWARF section are relative to the beginning of the + section so we begin .debug at 0. It's not clear yet what needs to happen + for the others. */ + .debug 0 : { *(.debug) } + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_sfnames 0 : { *(.debug_sfnames) } + .line 0 : { *(.line) } + /* These must appear regardless of . */ + .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } + .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } +}
CVS commit: src/sys/arch/powerpc/booke/dev
Module Name:src Committed By: matt Date: Thu Mar 29 14:47:09 UTC 2012 Modified Files: src/sys/arch/powerpc/booke/dev: pq3gpio.c Log Message: Fix P2020 GPIO support (which has pins that are input/output instead of just input or output). To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/powerpc/booke/dev/pq3gpio.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/booke/dev/pq3gpio.c diff -u src/sys/arch/powerpc/booke/dev/pq3gpio.c:1.4 src/sys/arch/powerpc/booke/dev/pq3gpio.c:1.5 --- src/sys/arch/powerpc/booke/dev/pq3gpio.c:1.4 Thu Jun 30 04:43:47 2011 +++ src/sys/arch/powerpc/booke/dev/pq3gpio.c Thu Mar 29 14:47:09 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pq3gpio.c,v 1.4 2011/06/30 04:43:47 matt Exp $ */ +/* $NetBSD: pq3gpio.c,v 1.5 2012/03/29 14:47:09 matt Exp $ */ /*- * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -35,12 +35,13 @@ */ #define GLOBAL_PRIVATE +#define GPIO_PRIVATE #include "opt_mpc85xx.h" #include -__KERNEL_RCSID(0, "$NetBSD: pq3gpio.c,v 1.4 2011/06/30 04:43:47 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pq3gpio.c,v 1.5 2012/03/29 14:47:09 matt Exp $"); #include #include @@ -108,6 +109,19 @@ pq3gpio_pin_write(void *v, int num, int static void pq3gpio_pin_ctl(void *v, int num, int ctl) { + struct pq3gpio_group * const gc = v; + const u_int mask = 1 << (gc->gc_pins[num].pin_num ^ 31); +uint32_t old, new; + +old = bus_space_read_4(gc->gc_bst, gc->gc_bsh, GPDIR); +new = old; +switch (ctl & (GPIO_PIN_INPUT|GPIO_PIN_OUTPUT)) { +case GPIO_PIN_OUTPUT:new |= mask; break; +case GPIO_PIN_INPUT: new &= ~mask; break; +default:return; +} +if (old != new) + bus_space_write_4(gc->gc_bst, gc->gc_bsh, GPDIR, new); } static void @@ -291,19 +305,21 @@ pq3gpio_p20x0_attach(device_t self, bus_ bus_space_handle_t bsh, u_int svr) { static const uint32_t gpio2pmuxcr_map[][2] = { - { __BIT(10), PMUXCR_TSEC3_TS|PMUXCR_USB }, - { __BIT(11), PMUXCR_TSEC3_TS|PMUXCR_USB }, - { __BIT(12), PMUXCR_TSEC1_TS }, - { __BIT(13), PMUXCR_TSEC1_TS }, - { __BIT(14), PMUXCR_TSEC2_TS }, - { __BIT(15), PMUXCR_TSEC2_TS }, + { __BIT(8), PMUXCR_SDHC_CD }, + { __BIT(9), PMUXCR_SDHC_WP }, + /* + * These are really two bits but the low bit MBZ so we ignore + * it. + */ + { __BIT(10), PMUXCR_TSEC3_TS }, + { __BIT(11), PMUXCR_TSEC3_TS }, }; - uint32_t pinmask = ~0; /* assume all bits are valid */ - size_t pincnt = 32; + uint32_t pinmask = 0x; /* assume all bits are valid */ + size_t pincnt = 16; const uint32_t pmuxcr = bus_space_read_4(bst, bsh, PMUXCR); for (size_t i = 0; i < __arraycount(gpio2pmuxcr_map); i++) { - if (pmuxcr & gpio2pmuxcr_map[i][1]) { + if ((pmuxcr & gpio2pmuxcr_map[i][1]) == 0) { pinmask &= ~gpio2pmuxcr_map[i][0]; pincnt--; } @@ -312,10 +328,10 @@ pq3gpio_p20x0_attach(device_t self, bus_ /* * Create GPIO pin groups */ - aprint_normal_dev(self, "%zu input pins, %zu output pins\n", - pincnt, pincnt); - pq3gpio_group_create(self, bst, bsh, GPINDR, pinmask, GPIO_PIN_INPUT); - pq3gpio_group_create(self, bst, bsh, GPOUTDR, pinmask, GPIO_PIN_OUTPUT); + aprint_normal_dev(self, "%zu input/output pins\n", + pincnt); + pq3gpio_group_create(self, bst, bsh, GPDAT, pinmask, + GPIO_PIN_INPUT|GPIO_PIN_OUTPUT); } #endif /* P2020 */
CVS commit: src/lib/libc/gen
Module Name:src Committed By: christos Date: Thu Mar 29 14:43:58 UTC 2012 Modified Files: src/lib/libc/gen: getpwent.c Log Message: PR/46279: Dr. W. Stukenbrock: Off-by-one in buffer length check and make sure that the password fits in the supplied buffer. To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/lib/libc/gen/getpwent.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/gen/getpwent.c diff -u src/lib/libc/gen/getpwent.c:1.78 src/lib/libc/gen/getpwent.c:1.79 --- src/lib/libc/gen/getpwent.c:1.78 Thu Mar 29 09:05:10 2012 +++ src/lib/libc/gen/getpwent.c Thu Mar 29 10:43:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: getpwent.c,v 1.78 2012/03/29 13:05:10 christos Exp $ */ +/* $NetBSD: getpwent.c,v 1.79 2012/03/29 14:43:58 christos Exp $ */ /*- * Copyright (c) 1997-2000, 2004-2005 The NetBSD Foundation, Inc. @@ -88,7 +88,7 @@ #if 0 static char sccsid[] = "@(#)getpwent.c 8.2 (Berkeley) 4/27/95"; #else -__RCSID("$NetBSD: getpwent.c,v 1.78 2012/03/29 13:05:10 christos Exp $"); +__RCSID("$NetBSD: getpwent.c,v 1.79 2012/03/29 14:43:58 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -1230,7 +1230,7 @@ _nis_parse(const char *entry, struct pas _DIAGASSERT(buf != NULL); _DIAGASSERT(state != NULL); - elen = strlen(entry); + elen = strlen(entry) + 1; if (elen >= buflen) return 0; if (! _pw_parse(entry, pw, buf, buflen, @@ -1248,10 +1248,14 @@ _nis_parse(const char *entry, struct pas char *bp, *ep; /* skip name to get password */ ep = data; - if ((bp = strsep(&ep, ":")) != NULL && + if (strsep(&ep, ":") != NULL && (bp = strsep(&ep, ":")) != NULL) { /* store new pw_passwd after entry */ -strlcpy(buf + elen, bp, buflen - elen); +if (strlcpy(buf + elen, bp, buflen - elen) >= +buflen - elen) { + free(data); + return 0; +} pw->pw_passwd = &buf[elen]; } free(data);
CVS commit: src/lib/libc/stdio
Module Name:src Committed By: christos Date: Thu Mar 29 14:27:34 UTC 2012 Modified Files: src/lib/libc/stdio: fmemopen.c Log Message: The flush function makes the tests fail. So undo it for now until we decide if the tests are wrong or the flushing is wrong. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libc/stdio/fmemopen.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/stdio/fmemopen.c diff -u src/lib/libc/stdio/fmemopen.c:1.7 src/lib/libc/stdio/fmemopen.c:1.8 --- src/lib/libc/stdio/fmemopen.c:1.7 Tue Mar 27 11:05:42 2012 +++ src/lib/libc/stdio/fmemopen.c Thu Mar 29 10:27:33 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: fmemopen.c,v 1.7 2012/03/27 15:05:42 christos Exp $ */ +/* $NetBSD: fmemopen.c,v 1.8 2012/03/29 14:27:33 christos Exp $ */ /*- * Copyright (c)2007, 2010 Takehiko NOZAKI, @@ -29,7 +29,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: fmemopen.c,v 1.7 2012/03/27 15:05:42 christos Exp $"); +__RCSID("$NetBSD: fmemopen.c,v 1.8 2012/03/29 14:27:33 christos Exp $"); #endif /* LIBC_SCCS and not lint */ #include @@ -98,6 +98,7 @@ ok: return (ssize_t)(p->cur - s); } +#ifdef notyet static int fmemopen_flush(void *cookie) { @@ -111,6 +112,7 @@ fmemopen_flush(void *cookie) *p->cur = '\0'; return 0; } +#endif static off_t fmemopen_seek(void *cookie, off_t offset, int whence) @@ -221,7 +223,9 @@ fmemopen(void * __restrict buf, size_t s fp->_write = (flags & __SRD) ? NULL : fmemopen_write; fp->_read = (flags & __SWR) ? NULL : fmemopen_read; fp->_seek = fmemopen_seek; +#ifdef notyet fp->_flush = fmemopen_flush; +#endif fp->_cookie = (void *)cookie; return fp;
CVS commit: src/lib/libc/gen
Module Name:src Committed By: christos Date: Thu Mar 29 13:05:10 UTC 2012 Modified Files: src/lib/libc/gen: getgrent.c getpwent.c Log Message: PR?40728: W. Stukenbrock: Fix various issues with NIS-netgroups in users and groups. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/lib/libc/gen/getgrent.c cvs rdiff -u -r1.77 -r1.78 src/lib/libc/gen/getpwent.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/gen/getgrent.c diff -u src/lib/libc/gen/getgrent.c:1.65 src/lib/libc/gen/getgrent.c:1.66 --- src/lib/libc/gen/getgrent.c:1.65 Tue Mar 13 17:13:35 2012 +++ src/lib/libc/gen/getgrent.c Thu Mar 29 09:05:10 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: getgrent.c,v 1.65 2012/03/13 21:13:35 christos Exp $ */ +/* $NetBSD: getgrent.c,v 1.66 2012/03/29 13:05:10 christos Exp $ */ /*- * Copyright (c) 1999-2000, 2004-2005 The NetBSD Foundation, Inc. @@ -88,7 +88,7 @@ #if 0 static char sccsid[] = "@(#)getgrent.c 8.2 (Berkeley) 3/21/94"; #else -__RCSID("$NetBSD: getgrent.c,v 1.65 2012/03/13 21:13:35 christos Exp $"); +__RCSID("$NetBSD: getgrent.c,v 1.66 2012/03/29 13:05:10 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -1190,9 +1190,17 @@ _nis_getgrgid_r(void *nsrv, void *nscb, _DIAGASSERT(result != NULL); *result = NULL; - memset(&state, 0, sizeof(state)); - rv = __grscan_nis(retval, grp, buffer, buflen, &state, 1, NULL, gid); - __grend_nis(&state); +/* remark: we run under a global mutex inside of this module ... */ + if (_nis_state.stayopen) + { /* use global state only if stayopen is set - otherwiese we would blow up getgrent_r() ... */ + rv = __grscan_nis(retval, grp, buffer, buflen, &_nis_state, 1, NULL, gid); + } + else + { + memset(&state, 0, sizeof(state)); + rv = __grscan_nis(retval, grp, buffer, buflen, &state, 1, NULL, gid); + __grend_nis(&state); + } if (rv == NS_SUCCESS) *result = grp; return rv; @@ -1242,9 +1250,17 @@ _nis_getgrnam_r(void *nsrv, void *nscb, _DIAGASSERT(result != NULL); *result = NULL; - memset(&state, 0, sizeof(state)); - rv = __grscan_nis(retval, grp, buffer, buflen, &state, 1, name, 0); - __grend_nis(&state); +/* remark: we run under a global mutex inside of this module ... */ + if (_nis_state.stayopen) + { /* use global state only if stayopen is set - otherwiese we would blow up getgrent_r() ... */ + rv = __grscan_nis(retval, grp, buffer, buflen, &_nis_state, 1, name, 0); + } + else + { + memset(&state, 0, sizeof(state)); + rv = __grscan_nis(retval, grp, buffer, buflen, &state, 1, name, 0); + __grend_nis(&state); + } if (rv == NS_SUCCESS) *result = grp; return rv; Index: src/lib/libc/gen/getpwent.c diff -u src/lib/libc/gen/getpwent.c:1.77 src/lib/libc/gen/getpwent.c:1.78 --- src/lib/libc/gen/getpwent.c:1.77 Tue Mar 23 16:28:59 2010 +++ src/lib/libc/gen/getpwent.c Thu Mar 29 09:05:10 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: getpwent.c,v 1.77 2010/03/23 20:28:59 drochner Exp $ */ +/* $NetBSD: getpwent.c,v 1.78 2012/03/29 13:05:10 christos Exp $ */ /*- * Copyright (c) 1997-2000, 2004-2005 The NetBSD Foundation, Inc. @@ -88,7 +88,7 @@ #if 0 static char sccsid[] = "@(#)getpwent.c 8.2 (Berkeley) 4/27/95"; #else -__RCSID("$NetBSD: getpwent.c,v 1.77 2010/03/23 20:28:59 drochner Exp $"); +__RCSID("$NetBSD: getpwent.c,v 1.78 2012/03/29 13:05:10 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -1126,7 +1126,7 @@ struct nis_state { char *current; /* current first/next match */ int currentlen; /* length of _nis_current */ enum {/* shadow map type */ - NISMAP_UNKNOWN, /* unknown ... */ + NISMAP_UNKNOWN = 0, /* unknown ... */ NISMAP_NONE, /* none: use "passwd.by*" */ NISMAP_ADJUNCT, /* pw_passwd from "passwd.adjunct.*" */ NISMAP_MASTER /* all from "master.passwd.by*" */ @@ -1138,11 +1138,17 @@ static struct nis_state _nis_state; static struct passwd _nis_passwd; static char _nis_passwdbuf[_GETPW_R_SIZE_MAX]; +static const char __nis_pw_n_1[] = "master.passwd.byname"; +static const char __nis_pw_n_2[] = "passwd.byname"; +static const char __nis_pw_u_1[] = "master.passwd.byuid"; +static const char __nis_pw_u_2[] = "passwd.byuid"; + +static const char * const __nis_pw_n_map[4] = { __nis_pw_n_2, __nis_pw_n_2, __nis_pw_n_2, __nis_pw_n_1 }; +static const char * const __nis_pw_u_map[4] = { __nis_pw_u_2, __nis_pw_u_2, __nis_pw_u_2, __nis_pw_u_1 }; + /* macros for deciding which NIS maps to use. */ -#define PASSWD_BYNAME(x) ((x)->maptype == NISMAP_MASTER \ -? "master.passwd.byname" : "passwd.byname") -#define PASSWD_BYUID(x) ((x)->maptype == NISMAP_MASTER \ -? "master.passwd.byuid" : "passwd.byuid") +#define PASSWD_BYNAME(x) ((x)->maptype == NISMAP_MASTER ? __nis_pw_n_1 : __nis_pw_n_2) +#define PASSWD_BYUID(x) ((x)->maptype == NISMAP_MASTER ? __nis_pw_u_1 : __nis_pw_u_2) static int _nis_sta
CVS commit: src/sys/arch/hp700/hp700
Module Name:src Committed By: skrll Date: Thu Mar 29 09:26:24 UTC 2012 Modified Files: src/sys/arch/hp700/hp700: intr.c Log Message: Check for HPPA_SID_KERNEL when checking for interrupt in the mutex_enter critical section. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/arch/hp700/hp700/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/hp700/hp700/intr.c diff -u src/sys/arch/hp700/hp700/intr.c:1.37 src/sys/arch/hp700/hp700/intr.c:1.38 --- src/sys/arch/hp700/hp700/intr.c:1.37 Thu Mar 1 21:10:00 2012 +++ src/sys/arch/hp700/hp700/intr.c Thu Mar 29 09:26:24 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.37 2012/03/01 21:10:00 skrll Exp $ */ +/* $NetBSD: intr.c,v 1.38 2012/03/29 09:26:24 skrll Exp $ */ /* $OpenBSD: intr.c,v 1.27 2009/12/31 12:52:35 jsing Exp $ */ /* @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.37 2012/03/01 21:10:00 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.38 2012/03/29 09:26:24 skrll Exp $"); #define __MUTEX_PRIVATE @@ -391,7 +391,8 @@ hppa_intr(struct trapframe *frame) * interrupt handlers need to aquire the mutex, they could deadlock if * the owner value is left unset. */ - if (frame->tf_iioq_head >= (u_int)mutex_enter_crit_start && + if (frame->tf_iisq_head == HPPA_SID_KERNEL && + frame->tf_iioq_head >= (u_int)mutex_enter_crit_start && frame->tf_iioq_head <= (u_int)mutex_enter_crit_end && frame->tf_ret0 != 0) ((kmutex_t *)frame->tf_arg0)->mtx_owner = (uintptr_t)curlwp;
CVS commit: src/tests/lib/libc/stdlib
Module Name:src Committed By: jruoho Date: Thu Mar 29 08:56:06 UTC 2012 Modified Files: src/tests/lib/libc/stdlib: t_random.c Log Message: Adjust as per apb@'s suggestion. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/stdlib/t_random.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/stdlib/t_random.c diff -u src/tests/lib/libc/stdlib/t_random.c:1.2 src/tests/lib/libc/stdlib/t_random.c:1.3 --- src/tests/lib/libc/stdlib/t_random.c:1.2 Wed Mar 28 10:38:00 2012 +++ src/tests/lib/libc/stdlib/t_random.c Thu Mar 29 08:56:06 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: t_random.c,v 1.2 2012/03/28 10:38:00 jruoho Exp $ */ +/* $NetBSD: t_random.c,v 1.3 2012/03/29 08:56:06 jruoho Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,47 +29,54 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_random.c,v 1.2 2012/03/28 10:38:00 jruoho Exp $"); +__RCSID("$NetBSD: t_random.c,v 1.3 2012/03/29 08:56:06 jruoho Exp $"); #include +#include #include /* * TODO: Add some general RNG tests (cf. the famous "diehard" tests?). */ -ATF_TC(random_zero); -ATF_TC_HEAD(random_zero, tc) +ATF_TC(random_same); +ATF_TC_HEAD(random_same, tc) { atf_tc_set_md_var(tc, "descr", - "Test that random(3) does not always return " - "zero when the seed is initialized to zero"); + "Test that random(3) does not always return the same " + "value when the seed is initialized to zero"); } -ATF_TC_BODY(random_zero, tc) +#define MAX_ITER 10 + +ATF_TC_BODY(random_same, tc) { - const size_t n = 100; + long buf[MAX_ITER]; size_t i, j; - long x; /* * See CVE-2012-1577. */ srandom(0); - for (i = j = 0; i < n; i++) { + for (i = 0; i < __arraycount(buf); i++) { - if ((x = random()) == 0) - j++; - } + buf[i] = random(); + + for (j = 0; j < i; j++) { - ATF_REQUIRE(j != n); + (void)fprintf(stderr, "i = %zu, j = %zu: " + "%ld vs. %ld\n", i, j, buf[i], buf[j]); + + ATF_CHECK(buf[i] != buf[j]); + } + } } ATF_TP_ADD_TCS(tp) { - ATF_TP_ADD_TC(tp, random_zero); + ATF_TP_ADD_TC(tp, random_same); return atf_no_error(); }
CVS commit: src/usr.bin/xlint/arch/mips64
Module Name:src Committed By: macallan Date: Thu Mar 29 08:52:31 UTC 2012 Modified Files: src/usr.bin/xlint/arch/mips64: targparam.h Log Message: XXX Don't assume LP64 unless lint itself is built as LP64 On mips64 we default to n32 which produces errors when things like TARG_LONG_MAX don't fit into a long A proper fix would be to teach lint about different target ABIs so it can pick the right parameters, this is just a bandaid to make it slightly less wrong and allow a mips64 build to complete. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.bin/xlint/arch/mips64/targparam.h 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/xlint/arch/mips64/targparam.h diff -u src/usr.bin/xlint/arch/mips64/targparam.h:1.3 src/usr.bin/xlint/arch/mips64/targparam.h:1.4 --- src/usr.bin/xlint/arch/mips64/targparam.h:1.3 Tue Mar 27 19:24:02 2012 +++ src/usr.bin/xlint/arch/mips64/targparam.h Thu Mar 29 08:52:31 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: targparam.h,v 1.3 2012/03/27 19:24:02 christos Exp $ */ +/* $NetBSD: targparam.h,v 1.4 2012/03/29 08:52:31 macallan Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -35,8 +35,11 @@ * Machine-dependent target parameters for lint1. */ #include "schar.h" +#ifdef _LP64 #include "lp64.h" - +#else +#include "ilp32.h" +#endif /* * Should be set to 1 if the difference of two pointers is of type long * or the value of sizeof is of type unsigned long. Note this MUST be