CVS commit: src/sys/arch/bebox/bebox
Module Name:src Committed By: kiyohara Date: Sat Oct 30 06:11:18 UTC 2010 Modified Files: src/sys/arch/bebox/bebox: machdep.c Log Message: Remove unnecessary comment-outed line. To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 src/sys/arch/bebox/bebox/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/bebox/bebox/machdep.c diff -u src/sys/arch/bebox/bebox/machdep.c:1.98 src/sys/arch/bebox/bebox/machdep.c:1.99 --- src/sys/arch/bebox/bebox/machdep.c:1.98 Fri Nov 27 03:23:05 2009 +++ src/sys/arch/bebox/bebox/machdep.c Sat Oct 30 06:11:18 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.98 2009/11/27 03:23:05 rmind Exp $ */ +/* $NetBSD: machdep.c,v 1.99 2010/10/30 06:11:18 kiyohara Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.98 2009/11/27 03:23:05 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.99 2010/10/30 06:11:18 kiyohara Exp $); #include opt_compat_netbsd.h #include opt_ddb.h @@ -157,11 +157,6 @@ ns_per_tick = 10 / ticks_per_sec; } - - /* - * boothowto - */ - /* boothowto = args; */ prep_initppc(startkernel, endkernel, args); }
CVS commit: src/sys/arch/arm/marvell
Module Name:src Committed By: kiyohara Date: Sat Oct 30 06:37:49 UTC 2010 Modified Files: src/sys/arch/arm/marvell: kirkwood.c Log Message: Fix mvPclk. Need 'break' each 'case'. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/marvell/kirkwood.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/marvell/kirkwood.c diff -u src/sys/arch/arm/marvell/kirkwood.c:1.1 src/sys/arch/arm/marvell/kirkwood.c:1.2 --- src/sys/arch/arm/marvell/kirkwood.c:1.1 Sun Oct 3 05:49:24 2010 +++ src/sys/arch/arm/marvell/kirkwood.c Sat Oct 30 06:37:49 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: kirkwood.c,v 1.1 2010/10/03 05:49:24 kiyohara Exp $ */ +/* $NetBSD: kirkwood.c,v 1.2 2010/10/30 06:37:49 kiyohara Exp $ */ /* * Copyright (c) 2010 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: kirkwood.c,v 1.1 2010/10/03 05:49:24 kiyohara Exp $); +__KERNEL_RCSID(0, $NetBSD: kirkwood.c,v 1.2 2010/10/30 06:37:49 kiyohara Exp $); #define _INTR_PRIVATE @@ -261,8 +261,8 @@ KIRKWOOD_MPP_SAMPLE_AT_RESET); if (model == MARVELL_KIRKWOOD_88F6180) { switch (reg 0x001c) { - case 0x0014: mvPclk = 600 MHz; - case 0x0018: mvPclk = 800 MHz; + case 0x0014: mvPclk = 600 MHz; break; + case 0x0018: mvPclk = 800 MHz; break; default: panic(unknown mvPclk\n); }
CVS commit: [uebayasi-xip] src/sys/arch/evbppc/conf
Module Name:src Committed By: uebayasi Date: Sat Oct 30 07:29:09 UTC 2010 Modified Files: src/sys/arch/evbppc/conf [uebayasi-xip]: OPENBLOCKS266_XIP Log Message: Add xmd(4). To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/evbppc/conf/OPENBLOCKS266_XIP 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/conf/OPENBLOCKS266_XIP diff -u src/sys/arch/evbppc/conf/OPENBLOCKS266_XIP:1.1.2.1 src/sys/arch/evbppc/conf/OPENBLOCKS266_XIP:1.1.2.2 --- src/sys/arch/evbppc/conf/OPENBLOCKS266_XIP:1.1.2.1 Wed Aug 11 14:03:10 2010 +++ src/sys/arch/evbppc/conf/OPENBLOCKS266_XIP Sat Oct 30 07:29:08 2010 @@ -1,8 +1,7 @@ -# $NetBSD: OPENBLOCKS266_XIP,v 1.1.2.1 2010/08/11 14:03:10 uebayasi Exp $ +# $NetBSD: OPENBLOCKS266_XIP,v 1.1.2.2 2010/10/30 07:29:08 uebayasi Exp $ # include arch/evbppc/conf/OPENBLOCKS266 -# $NetBSD: OPENBLOCKS266_XIP,v 1.1.2.1 2010/08/11 14:03:10 uebayasi Exp $ exb0 at plb? @@ -11,3 +10,6 @@ options __BUS_SPACE_HAS_PHYSLOAD_METHODS options XIP + +pseudo-device xmd 1 # XIP memory disk device +options XMD_ROOT_SIZE=10240 # 5MB
CVS commit: src/sys/arch/i386/stand/lib
Module Name:src Committed By: jnemeth Date: Sat Oct 30 08:12:43 UTC 2010 Modified Files: src/sys/arch/i386/stand/lib: exec.c Log Message: Reduce licence with copyright Perry E. Metzger and Matthias Drochner to two clauses. On Thu, 21 Oct 2010 22:42:00 -0700 jnem...@xxx (John Nemeth) wrote: The file src/sys/arch/i386/stand/lib/exec.c has a licence section that starts off saying copyright by each of you. That is then followed by a standard four claus UCB licence. Would it be okay to reduce that to the two claus licence that is now standard for NetBSD? I have no particular objections. -- Perry E. Metzgerpe...@xxx jnem...@xxx said: Would it be okay to reduce that to the two claus licence Yes of course, this is OK. best regards Matthias To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/arch/i386/stand/lib/exec.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/i386/stand/lib/exec.c diff -u src/sys/arch/i386/stand/lib/exec.c:1.44 src/sys/arch/i386/stand/lib/exec.c:1.45 --- src/sys/arch/i386/stand/lib/exec.c:1.44 Wed Aug 25 16:32:51 2010 +++ src/sys/arch/i386/stand/lib/exec.c Sat Oct 30 08:12:43 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: exec.c,v 1.44 2010/08/25 16:32:51 christos Exp $ */ +/* $NetBSD: exec.c,v 1.45 2010/10/30 08:12:43 jnemeth Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -71,13 +71,6 @@ * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in the *documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - *must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - *may be used to endorse or promote products derived from this software - *without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
CVS commit: [uebayasi-xip] src
Module Name:src Committed By: uebayasi Date: Sat Oct 30 08:41:14 UTC 2010 Modified Files: src/share/man/man9 [uebayasi-xip]: pmap.9 src/sys/arch/acorn26/acorn26 [uebayasi-xip]: mem.c pmap.c src/sys/arch/alpha/alpha [uebayasi-xip]: mem.c pmap.c src/sys/arch/amd64/amd64 [uebayasi-xip]: mem.c src/sys/arch/arm/arm32 [uebayasi-xip]: mem.c pmap.c src/sys/arch/arm/conf [uebayasi-xip]: files.arm src/sys/arch/cesfic/cesfic [uebayasi-xip]: mem.c src/sys/arch/hp300/hp300 [uebayasi-xip]: mem.c src/sys/arch/hp700/dev [uebayasi-xip]: mem.c src/sys/arch/hppa/hppa [uebayasi-xip]: pmap.c src/sys/arch/i386/i386 [uebayasi-xip]: mem.c src/sys/arch/luna68k/luna68k [uebayasi-xip]: mem.c src/sys/arch/m68k/m68k [uebayasi-xip]: pmap_motorola.c src/sys/arch/mac68k/mac68k [uebayasi-xip]: mem.c src/sys/arch/mips/conf [uebayasi-xip]: files.mips src/sys/arch/mips/mips [uebayasi-xip]: pmap.c src/sys/arch/mvme68k/mvme68k [uebayasi-xip]: mem.c src/sys/arch/news68k/news68k [uebayasi-xip]: mem.c src/sys/arch/next68k/next68k [uebayasi-xip]: mem.c src/sys/arch/powerpc/ibm4xx [uebayasi-xip]: pmap.c src/sys/arch/powerpc/oea [uebayasi-xip]: pmap.c src/sys/arch/powerpc/powerpc [uebayasi-xip]: mem.c src/sys/arch/sh3/sh3 [uebayasi-xip]: mem.c pmap.c src/sys/arch/sparc64/sparc64 [uebayasi-xip]: pmap.c src/sys/arch/sun2/sun2 [uebayasi-xip]: mem.c pmap.c src/sys/arch/sun3/sun3 [uebayasi-xip]: mem.c pmap.c src/sys/arch/sun3/sun3x [uebayasi-xip]: mem.c pmap.c src/sys/arch/usermode/usermode [uebayasi-xip]: pmap.c src/sys/arch/vax/vax [uebayasi-xip]: mem.c pmap.c src/sys/arch/x68k/x68k [uebayasi-xip]: mem.c src/sys/arch/x86/x86 [uebayasi-xip]: pmap.c src/sys/arch/xen/conf [uebayasi-xip]: files.xen src/sys/uvm [uebayasi-xip]: files.uvm uvm_pmap.h Added Files: src/sys/common/pmap [uebayasi-xip]: pmap_common.c Removed Files: src/sys/arch/arm/arm [uebayasi-xip]: xmd_machdep.c src/sys/arch/mips/mips [uebayasi-xip]: xmd_machdep.c src/sys/arch/powerpc/powerpc [uebayasi-xip]: xmd_machdep.c src/sys/arch/x86/x86 [uebayasi-xip]: xmd_machdep.c Log Message: Implement pmap_physload_device(9) to replace xmd(4) MD backend. Implement pmap_mmap(9) and use it from mem(4) and xmd(4). To generate a diff of this commit: cvs rdiff -u -r1.42.2.1 -r1.42.2.2 src/share/man/man9/pmap.9 cvs rdiff -u -r1.14 -r1.14.2.1 src/sys/arch/acorn26/acorn26/mem.c cvs rdiff -u -r1.30.2.4 -r1.30.2.5 src/sys/arch/acorn26/acorn26/pmap.c cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/arch/alpha/alpha/mem.c cvs rdiff -u -r1.252.2.4 -r1.252.2.5 src/sys/arch/alpha/alpha/pmap.c cvs rdiff -u -r1.19 -r1.19.2.1 src/sys/arch/amd64/amd64/mem.c cvs rdiff -u -r1.1.2.1 -r0 src/sys/arch/arm/arm/xmd_machdep.c cvs rdiff -u -r1.26.6.5 -r1.26.6.6 src/sys/arch/arm/arm32/mem.c cvs rdiff -u -r1.211.2.15 -r1.211.2.16 src/sys/arch/arm/arm32/pmap.c cvs rdiff -u -r1.97.2.4 -r1.97.2.5 src/sys/arch/arm/conf/files.arm cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/arch/cesfic/cesfic/mem.c cvs rdiff -u -r1.48 -r1.48.40.1 src/sys/arch/hp300/hp300/mem.c cvs rdiff -u -r1.21.2.2 -r1.21.2.3 src/sys/arch/hp700/dev/mem.c cvs rdiff -u -r1.63.2.7 -r1.63.2.8 src/sys/arch/hppa/hppa/pmap.c cvs rdiff -u -r1.72 -r1.72.2.1 src/sys/arch/i386/i386/mem.c cvs rdiff -u -r1.15 -r1.15.2.1 src/sys/arch/luna68k/luna68k/mem.c cvs rdiff -u -r1.55.2.3 -r1.55.2.4 src/sys/arch/m68k/m68k/pmap_motorola.c cvs rdiff -u -r1.40 -r1.40.4.1 src/sys/arch/mac68k/mac68k/mem.c cvs rdiff -u -r1.64.2.1 -r1.64.2.2 src/sys/arch/mips/conf/files.mips cvs rdiff -u -r1.188.2.4 -r1.188.2.5 src/sys/arch/mips/mips/pmap.c cvs rdiff -u -r1.1.2.1 -r0 src/sys/arch/mips/mips/xmd_machdep.c cvs rdiff -u -r1.27 -r1.27.30.1 src/sys/arch/mvme68k/mvme68k/mem.c cvs rdiff -u -r1.19 -r1.19.64.1 src/sys/arch/news68k/news68k/mem.c cvs rdiff -u -r1.25 -r1.25.64.1 src/sys/arch/next68k/next68k/mem.c cvs rdiff -u -r1.60.2.5 -r1.60.2.6 src/sys/arch/powerpc/ibm4xx/pmap.c cvs rdiff -u -r1.69.2.3 -r1.69.2.4 src/sys/arch/powerpc/oea/pmap.c cvs rdiff -u -r1.29 -r1.29.64.1 src/sys/arch/powerpc/powerpc/mem.c cvs rdiff -u -r1.1.2.2 -r0 src/sys/arch/powerpc/powerpc/xmd_machdep.c cvs rdiff -u -r1.26.64.2 -r1.26.64.3 src/sys/arch/sh3/sh3/mem.c cvs rdiff -u -r1.74.2.3 -r1.74.2.4 src/sys/arch/sh3/sh3/pmap.c cvs rdiff -u -r1.250.2.4 -r1.250.2.5 src/sys/arch/sparc64/sparc64/pmap.c cvs rdiff -u -r1.16 -r1.16.62.1 src/sys/arch/sun2/sun2/mem.c cvs rdiff -u -r1.43 -r1.43.2.1 src/sys/arch/sun2/sun2/pmap.c cvs rdiff -u -r1.51.64.1 -r1.51.64.2 src/sys/arch/sun3/sun3/mem.c cvs rdiff -u -r1.164.2.1 -r1.164.2.2 src/sys/arch/sun3/sun3/pmap.c cvs rdiff -u -r1.33.64.1 -r1.33.64.2 src/sys/arch/sun3/sun3x/mem.c cvs rdiff -u -r1.110.2.1 -r1.110.2.2 src/sys/arch/sun3/sun3x/pmap.c cvs rdiff -u -r1.5 -r1.5.2.1
CVS commit: [uebayasi-xip] src/sys/arch
Module Name:src Committed By: uebayasi Date: Sat Oct 30 08:43:12 UTC 2010 Modified Files: src/sys/arch/powerpc/conf [uebayasi-xip]: files.powerpc src/sys/arch/x86/conf [uebayasi-xip]: files.x86 Log Message: xmd_machdep.c is gone. To generate a diff of this commit: cvs rdiff -u -r1.71.4.4 -r1.71.4.5 src/sys/arch/powerpc/conf/files.powerpc cvs rdiff -u -r1.54.2.2 -r1.54.2.3 src/sys/arch/x86/conf/files.x86 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.71.4.4 src/sys/arch/powerpc/conf/files.powerpc:1.71.4.5 --- src/sys/arch/powerpc/conf/files.powerpc:1.71.4.4 Wed Aug 25 14:33:07 2010 +++ src/sys/arch/powerpc/conf/files.powerpc Sat Oct 30 08:43:12 2010 @@ -1,4 +1,4 @@ -# $NetBSD: files.powerpc,v 1.71.4.4 2010/08/25 14:33:07 uebayasi Exp $ +# $NetBSD: files.powerpc,v 1.71.4.5 2010/10/30 08:43:12 uebayasi Exp $ defflag opt_altivec.h ALTIVEC K_ALTIVEC defflag opt_openpic.h OPENPIC OPENPIC_SERIAL_MODE @@ -94,5 +94,3 @@ file arch/powerpc/powerpc/linux_sigcode.S compat_linux file arch/powerpc/powerpc/linux_trap.c compat_linux file arch/powerpc/powerpc/linux_syscall.c compat_linux - -file arch/powerpc/powerpc/xmd_machdep.c xmd Index: src/sys/arch/x86/conf/files.x86 diff -u src/sys/arch/x86/conf/files.x86:1.54.2.2 src/sys/arch/x86/conf/files.x86:1.54.2.3 --- src/sys/arch/x86/conf/files.x86:1.54.2.2 Fri Aug 20 07:04:37 2010 +++ src/sys/arch/x86/conf/files.x86 Sat Oct 30 08:43:12 2010 @@ -1,4 +1,4 @@ -# $NetBSD: files.x86,v 1.54.2.2 2010/08/20 07:04:37 uebayasi Exp $ +# $NetBSD: files.x86,v 1.54.2.3 2010/10/30 08:43:12 uebayasi Exp $ # options for MP configuration through the MP spec defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI @@ -121,8 +121,6 @@ file arch/x86/x86/tprof_pmi.c tprof needs-flag -file arch/x86/x86/xmd_machdep.c xmd - file arch/x86/pci/pci_machdep.c pci file arch/x86/pci/pci_intr_machdep.c pci
CVS commit: [uebayasi-xip] src/sys/dev
Module Name:src Committed By: uebayasi Date: Sat Oct 30 08:51:10 UTC 2010 Modified Files: src/sys/dev [uebayasi-xip]: xmd.c Removed Files: src/sys/dev [uebayasi-xip]: xmdvar.h Log Message: Adapt to thew new pmap(9) interfaces. Don't conditionalize few lines of code for modularity. As suggested by Chuck Silvers. To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/dev/xmd.c cvs rdiff -u -r1.1.2.1 -r0 src/sys/dev/xmdvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/xmd.c diff -u src/sys/dev/xmd.c:1.1.2.4 src/sys/dev/xmd.c:1.1.2.5 --- src/sys/dev/xmd.c:1.1.2.4 Sat Aug 28 16:27:02 2010 +++ src/sys/dev/xmd.c Sat Oct 30 08:51:10 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: xmd.c,v 1.1.2.4 2010/08/28 16:27:02 uebayasi Exp $ */ +/* $NetBSD: xmd.c,v 1.1.2.5 2010/10/30 08:51:10 uebayasi Exp $ */ /*- * Copyright (c) 2010 Tsubai Masanari. All rights reserved. @@ -28,15 +28,11 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: xmd.c,v 1.1.2.4 2010/08/28 16:27:02 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: xmd.c,v 1.1.2.5 2010/10/30 08:51:10 uebayasi Exp $); #include opt_xip.h #include opt_xmd.h -#ifndef XIP -#error xmd(4) needs options XIP -#endif - #include sys/param.h #include sys/bus.h #include sys/conf.h @@ -53,7 +49,7 @@ #include machine/vmparam.h -#include dev/xmdvar.h +#include uvm/uvm_extern.h struct xmd_softc { vaddr_t sc_addr; @@ -127,9 +123,7 @@ sc-sc_addr = (vaddr_t)md_root_image; sc-sc_size = (size_t)md_root_size; -#ifdef XIP - sc-sc_phys = xmd_machdep_physload(sc-sc_addr, sc-sc_size); -#endif + sc-sc_phys = pmap_physload_device(sc-sc_addr, sc-sc_size, PROT_READ, 0); disk_init(sc-sc_dkdev, device_xname(self), NULL); disk_attach(sc-sc_dkdev); @@ -159,9 +153,7 @@ disk_detach(sc-sc_dkdev); disk_destroy(sc-sc_dkdev); -#ifdef XIP - xmd_machdep_physunload(sc-sc_phys); -#endif + pmap_physunload_device(sc-sc_phys); return 0; } @@ -210,14 +202,12 @@ return -1; switch (cmd) { -#ifdef XIP case DIOCGPHYSSEG: if (sc-sc_phys == NULL) error = EINVAL; else *(void **)data = sc-sc_phys; break; -#endif case DIOCGDINFO: *(struct disklabel *)data = *sc-sc_dkdev.dk_label; @@ -261,7 +251,7 @@ if ((u_int64_t)off = sc-sc_size) return -1; - return xmd_machdep_mmap(sc-sc_addr, off, prot); + return pmap_mmap(sc-sc_addr, off); } static void
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: uebayasi Date: Sat Oct 30 17:00:55 UTC 2010 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Use VM_PAGE_TO_MD() to locate struct vm_page_md. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.252 -r1.253 src/sys/arch/alpha/alpha/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.252 src/sys/arch/alpha/alpha/pmap.c:1.253 --- src/sys/arch/alpha/alpha/pmap.c:1.252 Thu Nov 26 00:19:11 2009 +++ src/sys/arch/alpha/alpha/pmap.c Sat Oct 30 17:00:54 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.252 2009/11/26 00:19:11 matt Exp $ */ +/* $NetBSD: pmap.c,v 1.253 2010/10/30 17:00:54 uebayasi Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc. @@ -140,7 +140,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.252 2009/11/26 00:19:11 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.253 2010/10/30 17:00:54 uebayasi Exp $); #include sys/param.h #include sys/systm.h @@ -159,6 +159,8 @@ #include machine/rpb.h #endif +#define VM_PAGE_TO_MD(pg) ((pg)-mdpage) + #ifdef DEBUG #define PDB_FOLLOW 0x0001 #define PDB_INIT 0x0002 @@ -1401,6 +1403,7 @@ void pmap_page_protect(struct vm_page *pg, vm_prot_t prot) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); pmap_t pmap; pv_entry_t pv, nextpv; bool needkisync = false; @@ -1427,7 +1430,7 @@ PMAP_HEAD_TO_MAP_LOCK(); lock = pmap_pvh_lock(pg); mutex_enter(lock); - for (pv = pg-mdpage.pvh_list; pv != NULL; pv = pv-pv_next) { + for (pv = md-pvh_list; pv != NULL; pv = pv-pv_next) { PMAP_LOCK(pv-pv_pmap); if (*pv-pv_pte (PG_KWE | PG_UWE)) { *pv-pv_pte = ~(PG_KWE | PG_UWE); @@ -1452,7 +1455,7 @@ PMAP_HEAD_TO_MAP_LOCK(); lock = pmap_pvh_lock(pg); mutex_enter(lock); - for (pv = pg-mdpage.pvh_list; pv != NULL; pv = nextpv) { + for (pv = md-pvh_list; pv != NULL; pv = nextpv) { nextpv = pv-pv_next; pmap = pv-pv_pmap; @@ -1793,6 +1796,7 @@ */ npte = ((pa PGSHIFT) PG_SHIFT) | pte_prot(pmap, prot) | PG_V; if (pg != NULL) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); int attrs; #ifdef DIAGNOSTIC @@ -1802,10 +1806,10 @@ lock = pmap_pvh_lock(pg); mutex_enter(lock); if (flags VM_PROT_WRITE) - pg-mdpage.pvh_attrs |= (PGA_REFERENCED|PGA_MODIFIED); + md-pvh_attrs |= (PGA_REFERENCED|PGA_MODIFIED); else if (flags VM_PROT_ALL) - pg-mdpage.pvh_attrs |= PGA_REFERENCED; - attrs = pg-mdpage.pvh_attrs; + md-pvh_attrs |= PGA_REFERENCED; + attrs = md-pvh_attrs; mutex_exit(lock); /* @@ -2282,6 +2286,7 @@ bool pmap_clear_modify(struct vm_page *pg) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); bool rv = false; long cpu_id = cpu_number(); kmutex_t *lock; @@ -2295,10 +2300,10 @@ lock = pmap_pvh_lock(pg); mutex_enter(lock); - if (pg-mdpage.pvh_attrs PGA_MODIFIED) { + if (md-pvh_attrs PGA_MODIFIED) { rv = true; pmap_changebit(pg, PG_FOW, ~0, cpu_id); - pg-mdpage.pvh_attrs = ~PGA_MODIFIED; + md-pvh_attrs = ~PGA_MODIFIED; } mutex_exit(lock); @@ -2315,6 +2320,7 @@ bool pmap_clear_reference(struct vm_page *pg) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); bool rv = false; long cpu_id = cpu_number(); kmutex_t *lock; @@ -2328,10 +2334,10 @@ lock = pmap_pvh_lock(pg); mutex_enter(lock); - if (pg-mdpage.pvh_attrs PGA_REFERENCED) { + if (md-pvh_attrs PGA_REFERENCED) { rv = true; pmap_changebit(pg, PG_FOR | PG_FOW | PG_FOE, ~0, cpu_id); - pg-mdpage.pvh_attrs = ~PGA_REFERENCED; + md-pvh_attrs = ~PGA_REFERENCED; } mutex_exit(lock); @@ -2539,6 +2545,7 @@ static void pmap_changebit(struct vm_page *pg, u_long set, u_long mask, long cpu_id) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); pv_entry_t pv; pt_entry_t *pte, npte; vaddr_t va; @@ -2554,7 +2561,7 @@ /* * Loop over all current mappings setting/clearing as apropos. */ - for (pv = pg-mdpage.pvh_list; pv != NULL; pv = pv-pv_next) { + for (pv = md-pvh_list; pv != NULL; pv = pv-pv_next) { va = pv-pv_va; PMAP_LOCK(pv-pv_pmap); @@ -2681,16 +2688,17 @@ * (2) if it was a write fault, mark page as modified. */ pg = PHYS_TO_VM_PAGE(pa); + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); PMAP_HEAD_TO_MAP_LOCK(); lock = pmap_pvh_lock(pg); mutex_enter(lock); if (type == ALPHA_MMCSR_FOW) { - pg-mdpage.pvh_attrs |= (PGA_REFERENCED|PGA_MODIFIED); + md-pvh_attrs |= (PGA_REFERENCED|PGA_MODIFIED); faultoff = PG_FOR | PG_FOW; } else { - pg-mdpage.pvh_attrs |= PGA_REFERENCED; + md-pvh_attrs |= PGA_REFERENCED; faultoff = PG_FOR; if (exec) { faultoff |= PG_FOE; @@ -2713,16 +2721,18 @@ pmap_pv_dump(paddr_t pa) { struct vm_page *pg; + struct vm_page_md *md; pv_entry_t pv;
CVS commit: src/sys/arch/hppa/hppa
Module Name:src Committed By: uebayasi Date: Sat Oct 30 17:20:44 UTC 2010 Modified Files: src/sys/arch/hppa/hppa: pmap.c Log Message: Use VM_PAGE_TO_MD() to locate struct vm_page_md. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/arch/hppa/hppa/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/hppa/hppa/pmap.c diff -u src/sys/arch/hppa/hppa/pmap.c:1.76 src/sys/arch/hppa/hppa/pmap.c:1.77 --- src/sys/arch/hppa/hppa/pmap.c:1.76 Mon Jun 21 14:43:34 2010 +++ src/sys/arch/hppa/hppa/pmap.c Sat Oct 30 17:20:43 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.76 2010/06/21 14:43:34 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.77 2010/10/30 17:20:43 uebayasi Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.76 2010/06/21 14:43:34 skrll Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.77 2010/10/30 17:20:43 uebayasi Exp $); #include opt_cputype.h @@ -91,6 +91,8 @@ #include ddb/db_output.h #endif +#define VM_PAGE_TO_MD(pg) ((pg)-mdpage) + #ifdef PMAPDEBUG #define static /**/ @@ -497,27 +499,30 @@ pmap_dump_pv(paddr_t pa) { struct vm_page *pg; + struct vm_page_md *md; struct pv_entry *pve; pg = PHYS_TO_VM_PAGE(pa); - mutex_enter(pg-mdpage.pvh_lock); - db_printf(pg %p attr 0x%08x aliases %d\n, pg, pg-mdpage.pvh_attrs, - pg-mdpage.pvh_aliases); - for (pve = pg-mdpage.pvh_list; pve; pve = pve-pv_next) + md = VM_PAGE_TO_MD(pg); + mutex_enter(md-pvh_lock); + db_printf(pg %p attr 0x%08x aliases %d\n, pg, md-pvh_attrs, + md-pvh_aliases); + for (pve = md-pvh_list; pve; pve = pve-pv_next) db_printf(%x:%lx\n, pve-pv_pmap-pm_space, pve-pv_va PV_VAMASK); - mutex_exit(pg-mdpage.pvh_lock); + mutex_exit(md-pvh_lock); } #endif int pmap_check_alias(struct vm_page *pg, vaddr_t va, pt_entry_t pte) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); struct pv_entry *pve; int ret = 0; /* check for non-equ aliased mappings */ - for (pve = pg-mdpage.pvh_list; pve; pve = pve-pv_next) { + for (pve = md-pvh_list; pve; pve = pve-pv_next) { vaddr_t pva = pve-pv_va PV_VAMASK; pte |= pmap_vp_find(pve-pv_pmap, pva); @@ -566,26 +571,29 @@ pmap_pv_enter(struct vm_page *pg, struct pv_entry *pve, pmap_t pm, vaddr_t va, struct vm_page *pdep, u_int flags) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); + DPRINTF(PDB_FOLLOW|PDB_PV, (%s(%p, %p, %p, 0x%lx, %p, 0x%x)\n, __func__, pg, pve, pm, va, pdep, flags)); - KASSERT(mutex_owned(pg-mdpage.pvh_lock)); + KASSERT(mutex_owned(md-pvh_lock)); pve-pv_pmap = pm; pve-pv_va = va | flags; pve-pv_ptp = pdep; - pve-pv_next = pg-mdpage.pvh_list; - pg-mdpage.pvh_list = pve; + pve-pv_next = md-pvh_list; + md-pvh_list = pve; } static inline struct pv_entry * pmap_pv_remove(struct vm_page *pg, pmap_t pmap, vaddr_t va) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); struct pv_entry **pve, *pv; - KASSERT(mutex_owned(pg-mdpage.pvh_lock)); + KASSERT(mutex_owned(md-pvh_lock)); - for (pv = *(pve = pg-mdpage.pvh_list); + for (pv = *(pve = md-pvh_list); pv; pv = *(pve = (*pve)-pv_next)) if (pv-pv_pmap == pmap (pv-pv_va PV_VAMASK) == va) { *pve = pv-pv_next; @@ -1109,7 +1117,8 @@ continue; sheep = PHYS_TO_VM_PAGE(PTE_PAGE(*pde)); - for (haggis = sheep-mdpage.pvh_list; haggis != NULL; ) + struct vm_page_md * const md = VM_PAGE_TO_MD(sheep); + for (haggis = md-pvh_list; haggis != NULL; ) if (haggis-pv_pmap == pmap) { DPRINTF(PDB_FOLLOW, ( 0x%lx, @@ -1123,7 +1132,7 @@ * exploit the sacred knowledge of * lambeous ozzmosis */ - haggis = sheep-mdpage.pvh_list; + haggis = md-pvh_list; } else haggis = haggis-pv_next; } @@ -1206,10 +1215,11 @@ } pg = PHYS_TO_VM_PAGE(PTE_PAGE(pte)); - mutex_enter(pg-mdpage.pvh_lock); + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); + mutex_enter(md-pvh_lock); pve = pmap_pv_remove(pg, pmap, va); - pg-mdpage.pvh_attrs |= pmap_pvh_attrs(pte); - mutex_exit(pg-mdpage.pvh_lock); + md-pvh_attrs |= pmap_pvh_attrs(pte); + mutex_exit(md-pvh_lock); } else { DPRINTF(PDB_ENTER, (%s: new mapping 0x%lx - 0x%lx\n, __func__, va, pa)); @@ -1223,21 +1233,22 @@ } if (pmap_initialized (pg = PHYS_TO_VM_PAGE(pa))) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); if (!pve !(pve = pmap_pv_alloc())) { if (flags PMAP_CANFAIL) { - mutex_exit(pg-mdpage.pvh_lock); + mutex_exit(md-pvh_lock); PMAP_UNLOCK(pmap); return (ENOMEM); } panic(%s: no pv entries available, __func__); } pte |= PTE_PROT(pmap_prot(pmap, prot)); - mutex_enter(pg-mdpage.pvh_lock); + mutex_enter(md-pvh_lock); if (pmap_check_alias(pg, va, pte)) pmap_page_remove_locked(pg);
CVS commit: src/sys/arch/ia64/ia64
Module Name:src Committed By: uebayasi Date: Sat Oct 30 17:27:17 UTC 2010 Modified Files: src/sys/arch/ia64/ia64: pmap.c Log Message: Use VM_PAGE_TO_MD() to locate struct vm_page_md. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/ia64/ia64/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/ia64/ia64/pmap.c diff -u src/sys/arch/ia64/ia64/pmap.c:1.24 src/sys/arch/ia64/ia64/pmap.c:1.25 --- src/sys/arch/ia64/ia64/pmap.c:1.24 Sat Nov 7 07:27:44 2009 +++ src/sys/arch/ia64/ia64/pmap.c Sat Oct 30 17:27:17 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.24 2009/11/07 07:27:44 cegger Exp $ */ +/* $NetBSD: pmap.c,v 1.25 2010/10/30 17:27:17 uebayasi Exp $ */ /*- @@ -85,7 +85,7 @@ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.24 2009/11/07 07:27:44 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.25 2010/10/30 17:27:17 uebayasi Exp $); #include sys/param.h #include sys/systm.h @@ -102,6 +102,8 @@ #include machine/cpufunc.h #include machine/md_var.h +#define VM_PAGE_TO_MD(pg) ((pg)-mdpage) + /* * Kernel virtual memory management. @@ -1233,6 +1235,7 @@ bool pmap_clear_modify(struct vm_page *pg) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); bool rv = false; struct ia64_lpte *pte; pmap_t oldpmap; @@ -1241,7 +1244,7 @@ if (pg-flags PG_FAKE) return rv; - TAILQ_FOREACH(pv, pg-mdpage.pv_list, pv_list) { + TAILQ_FOREACH(pv, md-pv_list, pv_list) { PMAP_LOCK(pv-pv_pmap); oldpmap = pmap_install(pv-pv_pmap); pte = pmap_find_vhpt(pv-pv_va); @@ -1266,6 +1269,7 @@ void pmap_page_protect(struct vm_page *pg, vm_prot_t prot) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); struct ia64_lpte *pte; pmap_t oldpmap, pmap; pv_entry_t pv; @@ -1275,7 +1279,7 @@ if (prot (VM_PROT_READ | VM_PROT_EXECUTE)) { if (pg-flags PG_RDONLY) return; -TAILQ_FOREACH(pv, pg-mdpage.pv_list, pv_list) { +TAILQ_FOREACH(pv, md-pv_list, pv_list) { pmap = pv-pv_pmap; PMAP_LOCK(pmap); oldpmap = pmap_install(pmap); @@ -1489,8 +1493,9 @@ */ void -pmap_page_purge(struct vm_page * pg) +pmap_page_purge(struct vm_page *pg) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); pmap_t oldpmap; pv_entry_t pv; @@ -1505,7 +1510,7 @@ #endif //UVM_LOCK_ASSERT_PAGEQ(); - while ((pv = TAILQ_FIRST(pg-mdpage.pv_list)) != NULL) { + while ((pv = TAILQ_FIRST(md-pv_list)) != NULL) { struct ia64_lpte *pte; pmap_t pmap = pv-pv_pmap; vaddr_t va = pv-pv_va; @@ -1972,11 +1977,13 @@ * Remove an entry from the list of managed mappings. */ static int -pmap_remove_entry(pmap_t pmap, struct vm_page * pg, vaddr_t va, pv_entry_t pv) +pmap_remove_entry(pmap_t pmap, struct vm_page *pg, vaddr_t va, pv_entry_t pv) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); + if (!pv) { - if (pg-mdpage.pv_list_count pmap-pm_stats.resident_count) { - TAILQ_FOREACH(pv, pg-mdpage.pv_list, pv_list) { + if (md-pv_list_count pmap-pm_stats.resident_count) { + TAILQ_FOREACH(pv, md-pv_list, pv_list) { if (pmap == pv-pv_pmap va == pv-pv_va) break; } @@ -1989,9 +1996,9 @@ } if (pv) { - TAILQ_REMOVE(pg-mdpage.pv_list, pv, pv_list); - pg-mdpage.pv_list_count--; - if (TAILQ_FIRST(pg-mdpage.pv_list) == NULL) { + TAILQ_REMOVE(md-pv_list, pv, pv_list); + md-pv_list_count--; + if (TAILQ_FIRST(md-pv_list) == NULL) { //UVM_LOCK_ASSERT_PAGEQ(); pg-flags |= PG_RDONLY; } @@ -2012,6 +2019,7 @@ static void pmap_insert_entry(pmap_t pmap, vaddr_t va, struct vm_page *pg) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); pv_entry_t pv; pv = get_pv_entry(pmap); @@ -2021,8 +2029,8 @@ //LOCK_ASSERT(simple_lock_held(pmap-slock)); //UVM_LOCK_ASSERT_PAGEQ(); TAILQ_INSERT_TAIL(pmap-pm_pvlist, pv, pv_plist); - TAILQ_INSERT_TAIL(pg-mdpage.pv_list, pv, pv_list); - pg-mdpage.pv_list_count++; + TAILQ_INSERT_TAIL(md-pv_list, pv, pv_list); + md-pv_list_count++; } @@ -2092,13 +2100,14 @@ pa = VM_PAGE_TO_PHYS(pg); #ifdef DEBUG - mutex_enter(pg-mdpage.pv_mutex); + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); + mutex_enter(md-pv_mutex); if (pg-wire_count != 0) { printf(pmap_physpage_alloc: page 0x%lx has %d references\n, pa, pg-wire_count); panic(pmap_physpage_alloc); } - mutex_exit(pg-mdpage.pv_mutex); + mutex_exit(md-pv_mutex); #endif *pap = pa; return true; @@ -2120,10 +2129,11 @@ panic(pmap_physpage_free: bogus physical page address); #ifdef DEBUG - mutex_enter(pg-mdpage.pv_mutex); + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); + mutex_enter(md-pv_mutex); if (pg-wire_count != 0) panic(pmap_physpage_free: page still has references); -
CVS commit: src/sys/arch/mips/mips
Module Name:src Committed By: uebayasi Date: Sat Oct 30 17:44:04 UTC 2010 Modified Files: src/sys/arch/mips/mips: pmap.c Log Message: Use VM_PAGE_TO_MD() to locate struct vm_page_md. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.189 -r1.190 src/sys/arch/mips/mips/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/mips/pmap.c diff -u src/sys/arch/mips/mips/pmap.c:1.189 src/sys/arch/mips/mips/pmap.c:1.190 --- src/sys/arch/mips/mips/pmap.c:1.189 Tue Jul 6 20:50:34 2010 +++ src/sys/arch/mips/mips/pmap.c Sat Oct 30 17:44:04 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.189 2010/07/06 20:50:34 cegger Exp $ */ +/* $NetBSD: pmap.c,v 1.190 2010/10/30 17:44:04 uebayasi Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.189 2010/07/06 20:50:34 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.190 2010/10/30 17:44:04 uebayasi Exp $); /* * Manages physical address maps. @@ -134,6 +134,8 @@ #include mips/locore.h #include mips/pte.h +#define VM_PAGE_TO_MD(pg) ((pg)-mdpage) + CTASSERT(MIPS_KSEG0_START 0); CTASSERT((intptr_t)MIPS_PHYS_TO_KSEG0(0x1000) 0); CTASSERT(MIPS_KSEG1_START 0); @@ -265,6 +267,7 @@ mips_flushcache_allpvh(paddr_t pa) { struct vm_page *pg; + struct vm_page_md *md; struct pv_entry *pv; pg = PHYS_TO_VM_PAGE(pa); @@ -277,7 +280,8 @@ return; } - pv = pg-mdpage.pvh_list; + md = VM_PAGE_TO_MD(pg); + pv = md-pvh_list; #if defined(MIPS3_NO_PV_UNCACHED) /* No current mapping. Cache was flushed by pmap_remove_pv() */ @@ -522,7 +526,7 @@ for (bank = 0; bank vm_nphysseg; bank++) { s = vm_physmem[bank].end - vm_physmem[bank].start; for (i = 0; i s; i++) - vm_physmem[bank].pgs[i].mdpage.pvh_list = pv++; + VM_PAGE_TO_MD(vm_physmem[bank].pgs[i])-pvh_list = pv++; } /* @@ -861,6 +865,7 @@ void pmap_page_protect(struct vm_page *pg, vm_prot_t prot) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); pv_entry_t pv; vaddr_t va; @@ -878,7 +883,7 @@ /* copy_on_write */ case VM_PROT_READ: case VM_PROT_READ|VM_PROT_EXECUTE: - pv = pg-mdpage.pvh_list; + pv = md-pvh_list; /* * Loop over all current mappings setting/clearing as appropos. */ @@ -894,7 +899,7 @@ /* remove_all */ default: - pv = pg-mdpage.pvh_list; + pv = md-pvh_list; while (pv-pv_pmap != NULL) { pmap_remove(pv-pv_pmap, pv-pv_va, pv-pv_va + PAGE_SIZE); @@ -1079,6 +1084,7 @@ static void pmap_page_cache(struct vm_page *pg, int mode) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); pv_entry_t pv; pt_entry_t *pte; unsigned entry; @@ -1090,7 +1096,7 @@ printf(pmap_page_uncache(%#PRIxPADDR)\n, VM_PAGE_TO_PHYS(pg)); #endif newmode = mode PV_UNCACHED ? MIPS3_PG_UNCACHED : MIPS3_PG_CACHED; - pv = pg-mdpage.pvh_list; + pv = md-pvh_list; asid = pv-pv_pmap-pm_asid; needupdate = (pv-pv_pmap-pm_asidgen == pmap_asid_generation); @@ -1192,7 +1198,8 @@ pg = PHYS_TO_VM_PAGE(pa); if (pg) { - int *attrs = pg-mdpage.pvh_attrs; + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); + int *attrs = md-pvh_attrs; /* Set page referenced/modified status based on flags */ if (flags VM_PROT_WRITE) @@ -1646,7 +1653,8 @@ #if defined(MIPS3_PLUS) /* XXX mmu XXX */ pg = PHYS_TO_VM_PAGE(phys); if (mips_cache_virtual_alias) { - pv = pg-mdpage.pvh_list; + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); + pv = md-pvh_list; if ((pv-pv_flags PV_UNCACHED) == 0 mips_cache_indexof(pv-pv_va) != mips_cache_indexof(va)) mips_dcache_wbinv_range_index(pv-pv_va, PAGE_SIZE); @@ -1748,6 +1756,7 @@ bool pmap_clear_reference(struct vm_page *pg) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); int *attrp; bool rv; @@ -1756,7 +1765,7 @@ printf(pmap_clear_reference(%#PRIxPADDR)\n, VM_PAGE_TO_PHYS(pg)); #endif - attrp = pg-mdpage.pvh_attrs; + attrp = md-pvh_attrs; rv = *attrp PGA_REFERENCED; *attrp = ~PGA_REFERENCED; return rv; @@ -1771,8 +1780,9 @@ bool pmap_is_referenced(struct vm_page *pg) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); - return pg-mdpage.pvh_attrs PGA_REFERENCED; + return md-pvh_attrs PGA_REFERENCED; } /* @@ -1781,6 +1791,7 @@ bool pmap_clear_modify(struct vm_page *pg) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); struct pmap *pmap; struct pv_entry *pv; pt_entry_t *pte; @@ -1793,13 +1804,13 @@ if (pmapdebug PDB_FOLLOW) printf(pmap_clear_modify(%#PRIxPADDR)\n, VM_PAGE_TO_PHYS(pg)); #endif - attrp = pg-mdpage.pvh_attrs; + attrp = md-pvh_attrs; rv = *attrp PGA_MODIFIED; *attrp = ~PGA_MODIFIED; if (!rv) { return rv; } - pv = pg-mdpage.pvh_list; + pv = md-pvh_list; if (pv-pv_pmap == NULL) { return true; } @@ -1849,8 +1860,9 @@ bool pmap_is_modified(struct vm_page
CVS commit: src/sys/arch/powerpc
Module Name:src Committed By: uebayasi Date: Sat Oct 30 18:08:49 UTC 2010 Modified Files: src/sys/arch/powerpc/oea: pmap.c src/sys/arch/powerpc/powerpc: pmap_subr.c Log Message: Use VM_PAGE_TO_MD() to locate struct vm_page_md. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/sys/arch/powerpc/oea/pmap.c cvs rdiff -u -r1.22 -r1.23 src/sys/arch/powerpc/powerpc/pmap_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/oea/pmap.c diff -u src/sys/arch/powerpc/oea/pmap.c:1.71 src/sys/arch/powerpc/oea/pmap.c:1.72 --- src/sys/arch/powerpc/oea/pmap.c:1.71 Thu Feb 25 23:31:47 2010 +++ src/sys/arch/powerpc/oea/pmap.c Sat Oct 30 18:08:48 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.71 2010/02/25 23:31:47 matt Exp $ */ +/* $NetBSD: pmap.c,v 1.72 2010/10/30 18:08:48 uebayasi Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. @@ -63,7 +63,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.71 2010/02/25 23:31:47 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.72 2010/10/30 18:08:48 uebayasi Exp $); #define PMAP_NOOPNAMES @@ -91,6 +91,8 @@ #include powerpc/oea/spr.h #include powerpc/oea/sr_601.h +#define VM_PAGE_TO_MD(pg) ((pg)-mdpage) + #ifdef ALTIVEC int pmap_use_altivec; #endif @@ -690,38 +692,48 @@ pa_to_pvoh(paddr_t pa, struct vm_page **pg_p) { struct vm_page *pg; + struct vm_page_md *md; pg = PHYS_TO_VM_PAGE(pa); if (pg_p != NULL) *pg_p = pg; if (pg == NULL) return pmap_pvo_unmanaged; - return pg-mdpage.mdpg_pvoh; + md = VM_PAGE_TO_MD(pg); + return md-mdpg_pvoh; } static inline struct pvo_head * vm_page_to_pvoh(struct vm_page *pg) { - return pg-mdpage.mdpg_pvoh; + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); + + return md-mdpg_pvoh; } static inline void pmap_attr_clear(struct vm_page *pg, int ptebit) { - pg-mdpage.mdpg_attrs = ~ptebit; + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); + + md-mdpg_attrs = ~ptebit; } static inline int pmap_attr_fetch(struct vm_page *pg) { - return pg-mdpage.mdpg_attrs; + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); + + return md-mdpg_attrs; } static inline void pmap_attr_save(struct vm_page *pg, int ptebit) { - pg-mdpage.mdpg_attrs |= ptebit; + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); + + md-mdpg_attrs |= ptebit; } static inline int Index: src/sys/arch/powerpc/powerpc/pmap_subr.c diff -u src/sys/arch/powerpc/powerpc/pmap_subr.c:1.22 src/sys/arch/powerpc/powerpc/pmap_subr.c:1.23 --- src/sys/arch/powerpc/powerpc/pmap_subr.c:1.22 Thu Jan 28 12:37:45 2010 +++ src/sys/arch/powerpc/powerpc/pmap_subr.c Sat Oct 30 18:08:48 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_subr.c,v 1.22 2010/01/28 12:37:45 phx Exp $ */ +/* $NetBSD: pmap_subr.c,v 1.23 2010/10/30 18:08:48 uebayasi Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. @@ -29,7 +29,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pmap_subr.c,v 1.22 2010/01/28 12:37:45 phx Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap_subr.c,v 1.23 2010/10/30 18:08:48 uebayasi Exp $); #include opt_multiprocessor.h #include opt_altivec.h @@ -51,6 +51,8 @@ #endif #include powerpc/psl.h +#define VM_PAGE_TO_MD(pg) ((pg)-mdpage) + #define MFMSR() mfmsr() #define MTMSR(psl) __asm volatile(sync; mtmsr %0; isync :: r(psl)) @@ -292,14 +294,15 @@ * of this page since the page contents will have changed. */ struct vm_page *pg = PHYS_TO_VM_PAGE(pa); + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); KDASSERT(pg != NULL); - KDASSERT(LIST_EMPTY(pg-mdpage.mdpg_pvoh)); + KDASSERT(LIST_EMPTY(md-mdpg_pvoh)); #ifdef PMAPCOUNTERS - if (pg-mdpage.mdpg_attrs PTE_EXEC) { + if (md-mdpg_attrs PTE_EXEC) { PMAPCOUNT(exec_uncached_zero_page); } #endif - pg-mdpage.mdpg_attrs = ~PTE_EXEC; + md-mdpg_attrs = ~PTE_EXEC; } #endif @@ -372,14 +375,15 @@ * changed. */ struct vm_page *pg = PHYS_TO_VM_PAGE(dst); + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); KDASSERT(pg != NULL); - KDASSERT(LIST_EMPTY(pg-mdpage.mdpg_pvoh)); + KDASSERT(LIST_EMPTY(md-mdpg_pvoh)); #ifdef PMAPCOUNTERS - if (pg-mdpage.mdpg_attrs PTE_EXEC) { + if (md-mdpg_attrs PTE_EXEC) { PMAPCOUNT(exec_uncached_copy_page); } #endif - pg-mdpage.mdpg_attrs = ~PTE_EXEC; + md-mdpg_attrs = ~PTE_EXEC; } #endif
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uebayasi Date: Sat Oct 30 18:15:04 UTC 2010 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Use VM_PAGE_TO_MD() to locate struct vm_page_md. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/arch/sh3/sh3/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.74 src/sys/arch/sh3/sh3/pmap.c:1.75 --- src/sys/arch/sh3/sh3/pmap.c:1.74 Sat Nov 7 07:27:46 2009 +++ src/sys/arch/sh3/sh3/pmap.c Sat Oct 30 18:15:04 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.74 2009/11/07 07:27:46 cegger Exp $ */ +/* $NetBSD: pmap.c,v 1.75 2010/10/30 18:15:04 uebayasi Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.74 2009/11/07 07:27:46 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.75 2010/10/30 18:15:04 uebayasi Exp $); #include sys/param.h #include sys/systm.h @@ -43,6 +43,8 @@ #include sh3/mmu.h #include sh3/cache.h +#define VM_PAGE_TO_MD(pg) ((pg)-mdpage) + #ifdef DEBUG #define STATIC #else @@ -339,7 +341,7 @@ entry |= _PG_WIRED; if (pg != NULL) { /* memory-space */ - pvh = pg-mdpage; + pvh = VM_PAGE_TO_MD(pg); entry |= PG_C; /* always cached */ /* Seed modified/reference tracking */ @@ -483,7 +485,7 @@ * XXX mapping them uncached (like arm and mips do). */ again: - pvh = pg-mdpage; + pvh = VM_PAGE_TO_MD(pg); SLIST_FOREACH(pv, pvh-pvh_head, pv_link) { if (sh_cache_indexof(va) != sh_cache_indexof(pv-pv_va)) { @@ -495,7 +497,7 @@ } /* Register pv map */ - pvh = pg-mdpage; + pvh = VM_PAGE_TO_MD(pg); pv = __pmap_pv_alloc(); pv-pv_pmap = pmap; pv-pv_va = va; @@ -547,12 +549,12 @@ int s; s = splvm(); - pvh = pg-mdpage; + pvh = VM_PAGE_TO_MD(pg); SLIST_FOREACH(pv, pvh-pvh_head, pv_link) { if (pv-pv_pmap == pmap pv-pv_va == vaddr) { if (SH_HAS_VIRTUAL_ALIAS || (SH_HAS_WRITEBACK_CACHE -(pg-mdpage.pvh_flags PVH_MODIFIED))) { +(pvh-pvh_flags PVH_MODIFIED))) { /* * Always use index ops. since I don't want to * worry about address space. @@ -699,7 +701,7 @@ void pmap_page_protect(struct vm_page *pg, vm_prot_t prot) { - struct vm_page_md *pvh = pg-mdpage; + struct vm_page_md *pvh = VM_PAGE_TO_MD(pg); struct pv_entry *pv; struct pmap *pmap; vaddr_t va; @@ -789,24 +791,25 @@ bool pmap_is_referenced(struct vm_page *pg) { + struct vm_page_md *pvh = VM_PAGE_TO_MD(pg); - return ((pg-mdpage.pvh_flags PVH_REFERENCED) ? true : false); + return ((pvh-pvh_flags PVH_REFERENCED) ? true : false); } bool pmap_clear_reference(struct vm_page *pg) { - struct vm_page_md *pvh = pg-mdpage; + struct vm_page_md *pvh = VM_PAGE_TO_MD(pg); struct pv_entry *pv; pt_entry_t *pte; pmap_t pmap; vaddr_t va; int s; - if ((pg-mdpage.pvh_flags PVH_REFERENCED) == 0) + if ((pvh-pvh_flags PVH_REFERENCED) == 0) return (false); - pg-mdpage.pvh_flags = ~PVH_REFERENCED; + pvh-pvh_flags = ~PVH_REFERENCED; s = splvm(); /* Restart reference bit emulation */ @@ -831,14 +834,15 @@ bool pmap_is_modified(struct vm_page *pg) { + struct vm_page_md *pvh = VM_PAGE_TO_MD(pg); - return ((pg-mdpage.pvh_flags PVH_MODIFIED) ? true : false); + return ((pvh-pvh_flags PVH_MODIFIED) ? true : false); } bool pmap_clear_modify(struct vm_page *pg) { - struct vm_page_md *pvh = pg-mdpage; + struct vm_page_md *pvh = VM_PAGE_TO_MD(pg); struct pv_entry *pv; struct pmap *pmap; pt_entry_t *pte, entry; @@ -1023,12 +1027,14 @@ /* Emulate reference/modified tracking for managed page. */ if (flags != 0 (pg = PHYS_TO_VM_PAGE(entry PG_PPN)) != NULL) { + struct vm_page_md *pvh = VM_PAGE_TO_MD(pg); + if (flags PVH_REFERENCED) { - pg-mdpage.pvh_flags |= PVH_REFERENCED; + pvh-pvh_flags |= PVH_REFERENCED; entry |= PG_V; } if (flags PVH_MODIFIED) { - pg-mdpage.pvh_flags |= PVH_MODIFIED; + pvh-pvh_flags |= PVH_MODIFIED; entry |= PG_D; } *pte = entry;
CVS commit: src/sys/arch/sparc64/sparc64
Module Name:src Committed By: uebayasi Date: Sat Oct 30 18:30:55 UTC 2010 Modified Files: src/sys/arch/sparc64/sparc64: pmap.c Log Message: Use VM_PAGE_TO_MD() to locate struct vm_page_md. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.265 -r1.266 src/sys/arch/sparc64/sparc64/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc64/sparc64/pmap.c diff -u src/sys/arch/sparc64/sparc64/pmap.c:1.265 src/sys/arch/sparc64/sparc64/pmap.c:1.266 --- src/sys/arch/sparc64/sparc64/pmap.c:1.265 Thu Jul 29 10:54:50 2010 +++ src/sys/arch/sparc64/sparc64/pmap.c Sat Oct 30 18:30:55 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.265 2010/07/29 10:54:50 hannken Exp $ */ +/* $NetBSD: pmap.c,v 1.266 2010/10/30 18:30:55 uebayasi Exp $ */ /* * * Copyright (C) 1996-1999 Eduardo Horvath. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.265 2010/07/29 10:54:50 hannken Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.266 2010/10/30 18:30:55 uebayasi Exp $); #undef NO_VCACHE /* Don't forget the locked TLB in dostart */ #define HWREF @@ -73,6 +73,8 @@ #define db_printf printf #endif +#define VM_PAGE_TO_MD(pg) ((pg)-mdpage) + #define MEG (120) /* 1MB */ #define KB (110) /* 1KB */ @@ -1447,7 +1449,7 @@ KASSERT((pg-flags PG_MARKER) == 0); nextpg = TAILQ_NEXT(pg, listq.queue); TAILQ_REMOVE(pm-pm_obj.memq, pg, listq.queue); - KASSERT(pg-mdpage.mdpg_pvh.pv_pmap == NULL); + KASSERT(md-mdpg_pvh.pv_pmap == NULL); dcache_flush_page_cpuset(VM_PAGE_TO_PHYS(pg), pmap_cpus_active); uvm_pagefree(pg); } @@ -1714,7 +1716,9 @@ */ pg = PHYS_TO_VM_PAGE(pa); if (pg) { - pvh = pg-mdpage.mdpg_pvh; + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); + + pvh = md-mdpg_pvh; uncached = (pvh-pv_va (PV_ALIAS|PV_NVC)); #ifdef DIAGNOSTIC if ((flags VM_PROT_ALL) ~prot) @@ -2132,8 +2136,10 @@ pg = PHYS_TO_VM_PAGE(pa); if (pg) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); + /* Save REF/MOD info */ - pv = pg-mdpage.mdpg_pvh; + pv = md-mdpg_pvh; if (data TLB_ACCESS) pv-pv_va |= PV_REF; if (data TLB_MODIFY) @@ -2472,6 +2478,7 @@ bool pmap_clear_modify(struct vm_page *pg) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); pv_entry_t pv; int rv; int changed = 0; @@ -2484,7 +2491,7 @@ #endif mutex_enter(pmap_lock); /* Clear all mappings */ - pv = pg-mdpage.mdpg_pvh; + pv = md-mdpg_pvh; #ifdef DEBUG if (pv-pv_va PV_MOD) pv-pv_va |= PV_WE; /* Remember this was modified */ @@ -2553,6 +2560,7 @@ bool pmap_clear_reference(struct vm_page *pg) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); pv_entry_t pv; int rv; int changed = 0; @@ -2566,7 +2574,7 @@ referenced = pmap_is_referenced_locked(pg); #endif /* Clear all references */ - pv = pg-mdpage.mdpg_pvh; + pv = md-mdpg_pvh; if (pv-pv_va PV_REF) { changed |= 1; pv-pv_va = ~PV_REF; @@ -2619,7 +2627,7 @@ pv_check(); #ifdef DEBUG if (pmap_is_referenced_locked(pg)) { - pv = pg-mdpage.mdpg_pvh; + pv = md-mdpg_pvh; printf(pmap_clear_reference(): %p still referenced (pmap = %p, ctx = %d)\n, pg, pv-pv_pmap, pv-pv_pmap ? pmap_ctx(pv-pv_pmap) : 0); @@ -2644,11 +2652,12 @@ bool pmap_is_modified(struct vm_page *pg) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); pv_entry_t pv, npv; bool res = false; /* Check if any mapping has been modified */ - pv = pg-mdpage.mdpg_pvh; + pv = md-mdpg_pvh; if (pv-pv_va PV_MOD) res = true; #ifdef HWREF @@ -2698,13 +2707,14 @@ static bool pmap_is_referenced_locked(struct vm_page *pg) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); pv_entry_t pv, npv; bool res = false; KASSERT(mutex_owned(pmap_lock)); /* Check if any mapping has been referenced */ - pv = pg-mdpage.mdpg_pvh; + pv = md-mdpg_pvh; if (pv-pv_va PV_REF) return true; @@ -2746,11 +2756,12 @@ bool pmap_is_referenced(struct vm_page *pg) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); pv_entry_t pv; bool res = false; /* Check if any mapping has been referenced */ - pv = pg-mdpage.mdpg_pvh; + pv = md-mdpg_pvh; if (pv-pv_va PV_REF) return true; @@ -2822,6 +2833,7 @@ void pmap_page_protect(struct vm_page *pg, vm_prot_t prot) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); int64_t clear, set; int64_t data = 0; int rv; @@ -2834,7 +2846,7 @@ (pmap_page_protect: pg %p prot %x\n, pg, prot)); mutex_enter(pmap_lock); - pv = pg-mdpage.mdpg_pvh; + pv = md-mdpg_pvh; if (prot (VM_PROT_READ|VM_PROT_EXECUTE)) { /* copy_on_write */ @@ -3192,11 +3204,12 @@ pmap_enter_pv(struct pmap *pmap, vaddr_t va, paddr_t pa, struct vm_page *pg, pv_entry_t npv) { + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); pv_entry_t pvh; KASSERT(mutex_owned(pmap_lock)); - pvh = pg-mdpage.mdpg_pvh; + pvh =
CVS commit: src/sys/arch/arm/arm32
Module Name:src Committed By: uebayasi Date: Sat Oct 30 18:35:38 UTC 2010 Modified Files: src/sys/arch/arm/arm32: mem.c Log Message: Use VM_PAGE_TO_MD() to locate struct vm_page_md. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/arm32/mem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/mem.c diff -u src/sys/arch/arm/arm32/mem.c:1.26 src/sys/arch/arm/arm32/mem.c:1.27 --- src/sys/arch/arm/arm32/mem.c:1.26 Wed Nov 19 06:24:04 2008 +++ src/sys/arch/arm/arm32/mem.c Sat Oct 30 18:35:38 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.26 2008/11/19 06:24:04 matt Exp $ */ +/* $NetBSD: mem.c,v 1.27 2010/10/30 18:35:38 uebayasi Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -76,7 +76,7 @@ #include opt_compat_netbsd.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: mem.c,v 1.26 2008/11/19 06:24:04 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: mem.c,v 1.27 2010/10/30 18:35:38 uebayasi Exp $); #include sys/param.h #include sys/conf.h @@ -92,6 +92,8 @@ #include uvm/uvm_extern.h +#define VM_PAGE_TO_MD(pg) ((pg)-mdpage) + extern vaddr_t memhook; /* in pmap.c (poor name!) */ extern kmutex_t memlock; /* in pmap.c */ extern void *zeropage; /* in pmap.c */ @@ -145,7 +147,7 @@ struct vm_page *pg; pg = PHYS_TO_VM_PAGE(trunc_page(v)); if (pg != NULL pmap_is_page_colored_p(pg)) - o = pg-mdpage.pvh_attrs; + o = VM_PAGE_TO_MD(pg)-pvh_attrs; else o = v; m += o arm_cache_prefer_mask;
CVS commit: src/share/misc
Module Name:src Committed By: christos Date: Sat Oct 30 20:12:32 UTC 2010 Modified Files: src/share/misc: style Log Message: make usage dead. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/share/misc/style Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/misc/style diff -u src/share/misc/style:1.46 src/share/misc/style:1.47 --- src/share/misc/style:1.46 Fri Apr 23 20:54:07 2010 +++ src/share/misc/style Sat Oct 30 16:12:32 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: style,v 1.46 2010/04/24 00:54:07 christos Exp $ */ +/* $NetBSD: style,v 1.47 2010/10/30 20:12:32 christos Exp $ */ /* * The revision control tag appears first, with a blank line after it. @@ -30,7 +30,7 @@ #include sys/cdefs.h __COPYRIGHT(@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved.); -__RCSID($NetBSD: style,v 1.46 2010/04/24 00:54:07 christos Exp $); +__RCSID($NetBSD: style,v 1.47 2010/10/30 20:12:32 christos Exp $); /* * VERY important single-line comments look like this. @@ -121,7 +121,7 @@ static char *function(int, int, float, int); static int dirinfo(const char *, struct stat *, struct dirent *, struct statfs *, int *, char **[]); -static void usage(void); +static void usage(void) __dead; /* declare functions that don't return dead */ int main(int, char *[]); /*
CVS commit: src
Module Name:src Committed By: haad Date: Sat Oct 30 21:16:08 UTC 2010 Modified Files: src/distrib/sets/lists/base: mi src/distrib/sets/lists/man: mi src/sbin: Makefile src/sbin/resize_ffs: resize_ffs.8 resize_ffs.c Log Message: Add resize_ffs tool to build, change default behaviour to grow filesystem to device size. Add parameter -s to specify size if user want to shrink filesystem. Apply some KNF, remove dead unused code. Oked by chris...@. To generate a diff of this commit: cvs rdiff -u -r1.882 -r1.883 src/distrib/sets/lists/base/mi cvs rdiff -u -r1.1242 -r1.1243 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.116 -r1.117 src/sbin/Makefile cvs rdiff -u -r1.3 -r1.4 src/sbin/resize_ffs/resize_ffs.8 cvs rdiff -u -r1.12 -r1.13 src/sbin/resize_ffs/resize_ffs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/base/mi diff -u src/distrib/sets/lists/base/mi:1.882 src/distrib/sets/lists/base/mi:1.883 --- src/distrib/sets/lists/base/mi:1.882 Wed Oct 20 09:22:33 2010 +++ src/distrib/sets/lists/base/mi Sat Oct 30 21:16:08 2010 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.882 2010/10/20 09:22:33 jmmv Exp $ +# $NetBSD: mi,v 1.883 2010/10/30 21:16:08 haad Exp $ # # Note: Don't delete entries from here - mark them as obsolete instead, # unless otherwise stated below. @@ -295,6 +295,7 @@ ./sbin/rdump_lfsbase-sysutil-root ./sbin/reboot base-sysutil-root ./sbin/resolvconfbase-resolvconf-root +./sbin/resize_ffsbase-sysutil-root ./sbin/resize_lfsbase-sysutil-root ./sbin/restore base-sysutil-root ./sbin/rndctl base-sysutil-root Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1242 src/distrib/sets/lists/man/mi:1.1243 --- src/distrib/sets/lists/man/mi:1.1242 Sun Oct 24 08:54:14 2010 +++ src/distrib/sets/lists/man/mi Sat Oct 30 21:16:08 2010 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1242 2010/10/24 08:54:14 jruoho Exp $ +# $NetBSD: mi,v 1.1243 2010/10/30 21:16:08 haad Exp $ # # Note: don't delete entries from here - mark them as obsolete instead. # @@ -2552,6 +2552,7 @@ ./usr/share/man/cat8/renice.0 man-sysutil-catman .cat ./usr/share/man/cat8/repquota.0 man-sysutil-catman .cat ./usr/share/man/cat8/rescue.0 man-sysutil-catman .cat +./usr/share/man/cat8/resize_ffs.0 man-sysutil-catman .cat ./usr/share/man/cat8/resize_lfs.0 man-sysutil-catman .cat ./usr/share/man/cat8/resolvconf.0 man-resolvconf-catman .cat ./usr/share/man/cat8/restore.0 man-sysutil-catman .cat @@ -4991,6 +4992,7 @@ ./usr/share/man/html8/renice.html man-sysutil-htmlman html ./usr/share/man/html8/repquota.html man-sysutil-htmlman html ./usr/share/man/html8/rescue.html man-sysutil-htmlman html +./usr/share/man/html8/resize_ffs.html man-sysutil-htmlman html ./usr/share/man/html8/resize_lfs.html man-sysutil-htmlman html ./usr/share/man/html8/resolvconf.html man-resolvconf-htmlman html ./usr/share/man/html8/restore.html man-sysutil-htmlman html @@ -7706,6 +7708,7 @@ ./usr/share/man/man8/renice.8 man-sysutil-man .man ./usr/share/man/man8/repquota.8 man-sysutil-man .man ./usr/share/man/man8/rescue.8 man-sysutil-man .man +./usr/share/man/man8/resize_ffs.8 man-sysutil-man .man ./usr/share/man/man8/resize_lfs.8 man-sysutil-man .man ./usr/share/man/man8/resolvconf.8 man-resolvconf-man .man ./usr/share/man/man8/restore.8 man-sysutil-man .man Index: src/sbin/Makefile diff -u src/sbin/Makefile:1.116 src/sbin/Makefile:1.117 --- src/sbin/Makefile:1.116 Wed Mar 10 23:13:10 2010 +++ src/sbin/Makefile Sat Oct 30 21:16:07 2010 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.116 2010/03/10 23:13:10 abs Exp $ +# $NetBSD: Makefile,v 1.117 2010/10/30 21:16:07 haad Exp $ # @(#)Makefile 8.5 (Berkeley) 3/31/94 # Not ported: XNSrouted enpload scsiformat startslip @@ -16,7 +16,7 @@ # support for various file systems SUBDIR+= newfs_ext2fs fsck_ext2fs -SUBDIR+= newfs fsck_ffs fsdb dump restore clri tunefs +SUBDIR+= newfs fsck_ffs fsdb dump restore clri tunefs resize_ffs SUBDIR+= newfs_lfs fsck_lfs dump_lfs resize_lfs SUBDIR+= newfs_msdos fsck_msdos SUBDIR+= newfs_sysvbfs Index: src/sbin/resize_ffs/resize_ffs.8 diff -u src/sbin/resize_ffs/resize_ffs.8:1.3 src/sbin/resize_ffs/resize_ffs.8:1.4 --- src/sbin/resize_ffs/resize_ffs.8:1.3 Mon Mar 10 09:23:23 2003 +++ src/sbin/resize_ffs/resize_ffs.8 Sat Oct 30 21:16:07 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: resize_ffs.8,v 1.3 2003/03/10 09:23:23 wiz Exp $ +.\ $NetBSD: resize_ffs.8,v 1.4 2010/10/30 21:16:07 haad Exp $ .\ .\ As its sole author, I explicitly place this man page in the public .\ domain. Anyone may use it in any way for any purpose (though I would @@ -16,16 +16,14 @@ .Nd resize an on-disk file system .Sh SYNOPSIS .Nm +.Op Fl y +.Op Fl s Ar size .Ar file-system-raw-device -.Ar newsize .Sh DESCRIPTION .Nm resizes a file system on disk. .Ar
CVS commit: [uebayasi-xip] src/sys/arch/arm/arm32
Module Name:src Committed By: uebayasi Date: Sun Oct 31 03:43:03 UTC 2010 Modified Files: src/sys/arch/arm/arm32 [uebayasi-xip]: pmap.c Log Message: More struct vm_page * - struct vm_page_md * adjustments. To generate a diff of this commit: cvs rdiff -u -r1.211.2.16 -r1.211.2.17 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.211.2.16 src/sys/arch/arm/arm32/pmap.c:1.211.2.17 --- src/sys/arch/arm/arm32/pmap.c:1.211.2.16 Sat Oct 30 08:41:06 2010 +++ src/sys/arch/arm/arm32/pmap.c Sun Oct 31 03:43:02 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.211.2.16 2010/10/30 08:41:06 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.211.2.17 2010/10/31 03:43:02 uebayasi Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -212,7 +212,7 @@ #include machine/param.h #include arm/arm32/katelib.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.16 2010/10/30 08:41:06 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.17 2010/10/31 03:43:02 uebayasi Exp $); #ifdef PMAP_DEBUG @@ -663,7 +663,7 @@ static void pmap_vac_me_user(struct vm_page_md *, paddr_t, pmap_t, vaddr_t); #endif -static void pmap_clearbit(struct vm_page *, u_int); +static void pmap_clearbit(struct vm_page_md *, paddr_t, u_int); #ifdef PMAP_CACHE_VIVT static int pmap_clean_page(struct pv_entry *, bool); #endif @@ -676,7 +676,7 @@ }; static void pmap_flush_page(struct vm_page_md *, paddr_t, enum pmap_flush_op); #endif -static void pmap_page_remove(struct vm_page *); +static void pmap_page_remove(struct vm_page_md *, paddr_t); static void pmap_init_l1(struct l1_ttable *, pd_entry_t *); static vaddr_t kernel_pt_lookup(paddr_t); @@ -974,7 +974,7 @@ while (pv) { if (pv-pv_pmap == pm pv-pv_va == va) { /* match? */ NPDEBUG(PDB_PVDUMP, printf(pmap_remove_pv: pm %p, md - %p\n, pm, md)); + %p, flags 0x%x\n, pm, md, pv-pv_flags)); if (pv-pv_flags PVF_WIRED) { --pm-pm_stats.wired_count; } @@ -2121,9 +2121,8 @@ * constants and the latter would require an extra inversion at run-time. */ static void -pmap_clearbit(struct vm_page *pg, u_int maskbits) +pmap_clearbit(struct vm_page_md *md, paddr_t pa, u_int maskbits) { - struct vm_page_md *md = VM_PAGE_TO_MD(pg); struct l2_bucket *l2b; struct pv_entry *pv; pt_entry_t *ptep, npte, opte; @@ -2138,8 +2137,8 @@ #endif NPDEBUG(PDB_BITS, - printf(pmap_clearbit: pg %p (0x%08lx) mask 0x%x\n, - pg, VM_PAGE_TO_PHYS(pg), maskbits)); + printf(pmap_clearbit: md %p mask 0x%x\n, + md, maskbits)); PMAP_HEAD_TO_MAP_LOCK(); simple_lock(md-pvh_slock); @@ -2317,7 +2316,7 @@ * If we need to sync the I-cache and we haven't done it yet, do it. */ if (need_syncicache !did_syncicache) { - pmap_syncicache_page(md, VM_PAGE_TO_PHYS(pg)); + pmap_syncicache_page(md, pa); PMAPCOUNT(exec_synced_clearbit); } /* @@ -2327,7 +2326,7 @@ */ if (need_vac_me_harder) { if (md-pvh_attrs PVF_NC) - pmap_vac_me_harder(md, VM_PAGE_TO_PHYS(pg), NULL, 0); + pmap_vac_me_harder(md, pa, NULL, 0); } #endif @@ -2567,10 +2566,8 @@ * Reflects back modify bits to the pager. */ static void -pmap_page_remove(struct vm_page *pg) +pmap_page_remove(struct vm_page_md *md, paddr_t pa) { - struct vm_page_md *md = VM_PAGE_TO_MD(pg); - paddr_t pa = VM_PAGE_TO_PHYS(pg); struct l2_bucket *l2b; struct pv_entry *pv, *npv, **pvp; pmap_t pm; @@ -2579,7 +2576,7 @@ u_int flags; NPDEBUG(PDB_FOLLOW, - printf(pmap_page_remove: pg %p (0x%08lx)\n, pg, + printf(pmap_page_remove: md %p (0x%08lx)\n, md, pa)); PMAP_HEAD_TO_MAP_LOCK(); @@ -2896,9 +2893,7 @@ */ if (opg) { struct vm_page_md *omd = VM_PAGE_TO_MD(opg); -paddr_t opa; - -opa = VM_PAGE_TO_PHYS(opg); +paddr_t opa = VM_PAGE_TO_PHYS(opg); /* * Replacing an existing mapping with a new one. @@ -2945,7 +2940,7 @@ return (ENOMEM); } - pmap_enter_pv(md, VM_PAGE_TO_PHYS(pg), pv, pm, va, nflags); + pmap_enter_pv(md, pa, pv, pm, va, nflags); } } else { /* @@ -2969,9 +2964,11 @@ * at this address. */ struct vm_page_md *omd = VM_PAGE_TO_MD(opg); + paddr_t opa = VM_PAGE_TO_PHYS(opg); + simple_lock(omd-pvh_slock); - pv = pmap_remove_pv(omd, VM_PAGE_TO_PHYS(opg), pm, va); - pmap_vac_me_harder(omd, VM_PAGE_TO_PHYS(opg), pm, 0); + pv = pmap_remove_pv(omd, opa, pm, va); + pmap_vac_me_harder(omd, opa, pm, 0); simple_unlock(omd-pvh_slock); oflags = pv-pv_flags; @@ -3052,14 +3049,16 @@ if (pg != NULL) { struct vm_page_md *md = VM_PAGE_TO_MD(pg); + simple_lock(md-pvh_slock); - pmap_vac_me_harder(md, VM_PAGE_TO_PHYS(pg), pm, va); + pmap_vac_me_harder(md, pa, pm, va); simple_unlock(md-pvh_slock); } } #if defined(PMAP_CACHE_VIPT) defined(DIAGNOSTIC) if
CVS commit: [uebayasi-xip] src/sys
Module Name:src Committed By: uebayasi Date: Sun Oct 31 03:46:20 UTC 2010 Modified Files: src/sys/arch/arm/arm32 [uebayasi-xip]: pmap.c src/sys/arch/hppa/hppa [uebayasi-xip]: pmap.c src/sys/arch/m68k/m68k [uebayasi-xip]: pmap_motorola.c src/sys/arch/mips/mips [uebayasi-xip]: pmap.c src/sys/arch/powerpc/ibm4xx [uebayasi-xip]: pmap.c src/sys/arch/sh3/sh3 [uebayasi-xip]: pmap.c src/sys/arch/sparc64/sparc64 [uebayasi-xip]: pmap.c src/sys/arch/x86/x86 [uebayasi-xip]: pmap.c src/sys/uvm [uebayasi-xip]: uvm_device.c uvm_pmap.h Log Message: We already have a flag PMAP_NOCACHE. s/PMAP_UNMANAGED/PMAN_NOCACHE/. Pointed out by Chuck Silvers, thanks. To generate a diff of this commit: cvs rdiff -u -r1.211.2.17 -r1.211.2.18 src/sys/arch/arm/arm32/pmap.c cvs rdiff -u -r1.63.2.8 -r1.63.2.9 src/sys/arch/hppa/hppa/pmap.c cvs rdiff -u -r1.55.2.4 -r1.55.2.5 src/sys/arch/m68k/m68k/pmap_motorola.c cvs rdiff -u -r1.188.2.5 -r1.188.2.6 src/sys/arch/mips/mips/pmap.c cvs rdiff -u -r1.60.2.6 -r1.60.2.7 src/sys/arch/powerpc/ibm4xx/pmap.c cvs rdiff -u -r1.74.2.4 -r1.74.2.5 src/sys/arch/sh3/sh3/pmap.c cvs rdiff -u -r1.250.2.5 -r1.250.2.6 src/sys/arch/sparc64/sparc64/pmap.c cvs rdiff -u -r1.100.2.5 -r1.100.2.6 src/sys/arch/x86/x86/pmap.c cvs rdiff -u -r1.57.2.2 -r1.57.2.3 src/sys/uvm/uvm_device.c cvs rdiff -u -r1.32.2.5 -r1.32.2.6 src/sys/uvm/uvm_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/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.211.2.17 src/sys/arch/arm/arm32/pmap.c:1.211.2.18 --- src/sys/arch/arm/arm32/pmap.c:1.211.2.17 Sun Oct 31 03:43:02 2010 +++ src/sys/arch/arm/arm32/pmap.c Sun Oct 31 03:46:16 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.211.2.17 2010/10/31 03:43:02 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.211.2.18 2010/10/31 03:46:16 uebayasi Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -212,7 +212,7 @@ #include machine/param.h #include arm/arm32/katelib.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.17 2010/10/31 03:43:02 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.211.2.18 2010/10/31 03:46:16 uebayasi Exp $); #ifdef PMAP_DEBUG @@ -2777,7 +2777,7 @@ * Get a pointer to the page. Later on in this function, we * test for a managed page by checking pg != NULL. */ - pg = (pmap_initialized ((flags PMAP_UNMANAGED) == 0)) ? + pg = (pmap_initialized ((flags PMAP_NOCACHE) == 0)) ? PHYS_TO_VM_PAGE(pa) : NULL; nflags = 0; Index: src/sys/arch/hppa/hppa/pmap.c diff -u src/sys/arch/hppa/hppa/pmap.c:1.63.2.8 src/sys/arch/hppa/hppa/pmap.c:1.63.2.9 --- src/sys/arch/hppa/hppa/pmap.c:1.63.2.8 Sat Oct 30 08:41:07 2010 +++ src/sys/arch/hppa/hppa/pmap.c Sun Oct 31 03:46:17 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.63.2.8 2010/10/30 08:41:07 uebayasi Exp $ */ +/* $NetBSD: pmap.c,v 1.63.2.9 2010/10/31 03:46:17 uebayasi Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.63.2.8 2010/10/30 08:41:07 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.63.2.9 2010/10/31 03:46:17 uebayasi Exp $); #include opt_xip.h @@ -1232,7 +1232,7 @@ ptp-wire_count++; } - if (pmap_initialized ((flags PMAP_UNMANAGED) == 0) + if (pmap_initialized ((flags PMAP_NOCACHE) == 0) (pg = PHYS_TO_VM_PAGE(pa))) { struct vm_page_md * const md = VM_PAGE_TO_MD(pg); Index: src/sys/arch/m68k/m68k/pmap_motorola.c diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.55.2.4 src/sys/arch/m68k/m68k/pmap_motorola.c:1.55.2.5 --- src/sys/arch/m68k/m68k/pmap_motorola.c:1.55.2.4 Sat Oct 30 08:41:08 2010 +++ src/sys/arch/m68k/m68k/pmap_motorola.c Sun Oct 31 03:46:17 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_motorola.c,v 1.55.2.4 2010/10/30 08:41:08 uebayasi Exp $*/ +/* $NetBSD: pmap_motorola.c,v 1.55.2.5 2010/10/31 03:46:17 uebayasi Exp $*/ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -119,7 +119,7 @@ #include opt_m68k_arch.h #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pmap_motorola.c,v 1.55.2.4 2010/10/30 08:41:08 uebayasi Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap_motorola.c,v 1.55.2.5 2010/10/31 03:46:17 uebayasi Exp $); #include sys/param.h #include sys/systm.h @@ -1272,7 +1272,7 @@ * Note that we raise IPL while manipulating pv_table * since pmap_enter can be called at interrupt time. */ - if (PAGE_IS_MANAGED(pa) ((flags PMAP_UNMANAGED) == 0)) { + if (PAGE_IS_MANAGED(pa) ((flags PMAP_NOCACHE) == 0)) { struct pv_header *pvh; struct pv_entry *pv, *npv; int s; Index: src/sys/arch/mips/mips/pmap.c diff -u src/sys/arch/mips/mips/pmap.c:1.188.2.5 src/sys/arch/mips/mips/pmap.c:1.188.2.6 --- src/sys/arch/mips/mips/pmap.c:1.188.2.5 Sat Oct 30 08:41:09 2010 +++ src/sys/arch/mips/mips/pmap.c Sun Oct 31 03:46:18 2010 @@ -1,4
CVS commit: src/sys/arch/i386/i386
Module Name:src Committed By: yamt Date: Sun Oct 31 04:51:19 UTC 2010 Modified Files: src/sys/arch/i386/i386: vector.S Log Message: keep interrupts disabled in NMI handler. the patch provided by IRINO yoshiaki in PR/43007. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/arch/i386/i386/vector.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/i386/i386/vector.S diff -u src/sys/arch/i386/i386/vector.S:1.53 src/sys/arch/i386/i386/vector.S:1.54 --- src/sys/arch/i386/i386/vector.S:1.53 Mon Feb 22 06:42:14 2010 +++ src/sys/arch/i386/i386/vector.S Sun Oct 31 04:51:19 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: vector.S,v 1.53 2010/02/22 06:42:14 darran Exp $ */ +/* $NetBSD: vector.S,v 1.54 2010/10/31 04:51:19 yamt Exp $ */ /* * Copyright 2002 (c) Wasabi Systems, Inc. @@ -65,7 +65,7 @@ */ #include machine/asm.h -__KERNEL_RCSID(0, $NetBSD: vector.S,v 1.53 2010/02/22 06:42:14 darran Exp $); +__KERNEL_RCSID(0, $NetBSD: vector.S,v 1.54 2010/10/31 04:51:19 yamt Exp $); #include opt_ddb.h #include opt_multiprocessor.h @@ -896,7 +896,10 @@ IDTVEC(trap01) BPTTRAP(T_TRCTRAP) IDTVEC(trap02) - ZTRAP(T_NMI) + pushl $0 + pushl $(T_NMI) + INTRENTRY + jmp _C_LABEL(calltrap) IDTVEC(trap03) BPTTRAP(T_BPTFLT) IDTVEC(trap04)
CVS commit: src/external/bsd/libelf/dist
Module Name:src Committed By: yamt Date: Sun Oct 31 05:03:12 UTC 2010 Modified Files: src/external/bsd/libelf/dist: _libelf.h elf_begin.c elf_end.c Log Message: fall back to malloc+pread when stat+malloc doesn't seem to work. it allows libelf work on /dev/ksyms. XXX the name of the flag is a bit confusing and i think it's better to rename MALLOCED to DATA_MALLOCED or such. but i don't think it's worth increasing the diff against the upstream for it. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/external/bsd/libelf/dist/_libelf.h cvs rdiff -u -r1.6 -r1.7 src/external/bsd/libelf/dist/elf_begin.c cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/elf_end.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libelf/dist/_libelf.h diff -u src/external/bsd/libelf/dist/_libelf.h:1.5 src/external/bsd/libelf/dist/_libelf.h:1.6 --- src/external/bsd/libelf/dist/_libelf.h:1.5 Tue Mar 2 21:08:36 2010 +++ src/external/bsd/libelf/dist/_libelf.h Sun Oct 31 05:03:12 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: _libelf.h,v 1.5 2010/03/02 21:08:36 darran Exp $ */ +/* $NetBSD: _libelf.h,v 1.6 2010/10/31 05:03:12 yamt Exp $ */ /*- * Copyright (c) 2006 Joseph Koshy @@ -75,6 +75,7 @@ #define LIBELF_F_MALLOCED 0x01 /* whether data was malloc'ed */ #define LIBELF_F_MMAP 0x02 /* whether e_rawfile was mmap'ed */ #define LIBELF_F_SHDRS_LOADED 0x04 /* whether all shdrs were read in */ +#define LIBELF_F_MALLOC 0x08 /* whether e_rawfile was mmap'ed */ struct _Elf { int e_activations; /* activation count */ Index: src/external/bsd/libelf/dist/elf_begin.c diff -u src/external/bsd/libelf/dist/elf_begin.c:1.6 src/external/bsd/libelf/dist/elf_begin.c:1.7 --- src/external/bsd/libelf/dist/elf_begin.c:1.6 Mon Feb 22 10:59:08 2010 +++ src/external/bsd/libelf/dist/elf_begin.c Sun Oct 31 05:03:12 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: elf_begin.c,v 1.6 2010/02/22 10:59:08 darran Exp $ */ +/* $NetBSD: elf_begin.c,v 1.7 2010/10/31 05:03:12 yamt Exp $ */ /*- * Copyright (c) 2006 Joseph Koshy @@ -41,6 +41,9 @@ #include err.h #include errno.h #include libelf.h +#include stdbool.h +#include stdlib.h +#include unistd.h #include _libelf.h @@ -49,7 +52,9 @@ { Elf *e; void *m; + void *p; /* malloc'ed pointer */ struct stat sb; + size_t objsize; /* * 'Raw' files are always mapped with 'PROT_READ'. At @@ -63,18 +68,76 @@ } m = NULL; - if ((m = mmap(NULL, (size_t) sb.st_size, PROT_READ, MAP_PRIVATE, fd, + p = NULL; + if (sb.st_size == 0) { + /* + * Might be a special device like /dev/ksyms. Try read(2)ing. + */ + goto doread; + } + objsize = (size_t) sb.st_size; + if ((m = mmap(NULL, objsize, PROT_READ, MAP_PRIVATE, fd, (off_t) 0)) == MAP_FAILED) { - LIBELF_SET_ERROR(IO, errno); - return (NULL); + size_t bufsize; + + if (errno != EINVAL) { + LIBELF_SET_ERROR(IO, errno); + return (NULL); + } +doread: + /* + * Fall back to malloc+read. + */ + bufsize = 1024 * 1024; + while (/*CONSTCOND*/true) { + void *newp = realloc(p, bufsize); + ssize_t rsz; + + if (newp == NULL) { +free(p); +LIBELF_SET_ERROR(RESOURCE, 0); +return (NULL); + } + p = newp; + rsz = pread(fd, p, bufsize, 0); + if (rsz == -1) { +free(p); +LIBELF_SET_ERROR(IO, errno); +return (NULL); + } else if ((size_t) rsz bufsize) { +free(p); +LIBELF_SET_ERROR(IO, EIO); /* XXX */ +return (NULL); + } else if ((size_t) rsz bufsize) { +/* + * try to shrink the buffer. + */ +newp = realloc(p, (size_t) rsz); +if (newp != NULL) { + p = newp; +} +break; + } + bufsize *= 2; + } + m = p; + objsize = bufsize; } - if ((e = elf_memory(m, (size_t) sb.st_size)) == NULL) { - (void) munmap(m, (size_t) sb.st_size); + if ((e = elf_memory(m, objsize)) == NULL) { + if (p != NULL) { + free(p); + } else { + (void) munmap(m, objsize); + } return (NULL); } - e-e_flags |= LIBELF_F_MMAP; + if (p != NULL) { + e-e_flags |= LIBELF_F_MALLOC; + } else { + e-e_flags |= LIBELF_F_MMAP; + } e-e_fd = fd; e-e_cmd = c; Index: src/external/bsd/libelf/dist/elf_end.c diff -u src/external/bsd/libelf/dist/elf_end.c:1.2 src/external/bsd/libelf/dist/elf_end.c:1.3 --- src/external/bsd/libelf/dist/elf_end.c:1.2 Mon Feb 22 10:48:32 2010 +++ src/external/bsd/libelf/dist/elf_end.c Sun Oct 31 05:03:12 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: elf_end.c,v 1.2 2010/02/22 10:48:32 darran Exp $ */ +/* $NetBSD: elf_end.c,v 1.3 2010/10/31 05:03:12 yamt Exp $ */ /*- * Copyright (c) 2006 Joseph Koshy @@ -82,6 +82,8 @@ if (e-e_flags LIBELF_F_MMAP) (void) munmap(e-e_rawfile, e-e_rawsize); + if (e-e_flags LIBELF_F_MALLOC) + (void) free(e-e_rawfile); sv = e; if ((e = e-e_parent) != NULL)