CVS commit: src/sys/ufs/lfs
Module Name:src Committed By: eeh Date: Sat Dec 18 00:01:46 UTC 2010 Modified Files: src/sys/ufs/lfs: lfs_vnops.c Log Message: Byebye deadlock. To generate a diff of this commit: cvs rdiff -u -r1.231 -r1.232 src/sys/ufs/lfs/lfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/lfs/lfs_vnops.c diff -u src/sys/ufs/lfs/lfs_vnops.c:1.231 src/sys/ufs/lfs/lfs_vnops.c:1.232 --- src/sys/ufs/lfs/lfs_vnops.c:1.231 Wed Aug 4 10:43:53 2010 +++ src/sys/ufs/lfs/lfs_vnops.c Sat Dec 18 00:01:46 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_vnops.c,v 1.231 2010/08/04 10:43:53 hannken Exp $ */ +/* $NetBSD: lfs_vnops.c,v 1.232 2010/12/18 00:01:46 eeh Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: lfs_vnops.c,v 1.231 2010/08/04 10:43:53 hannken Exp $); +__KERNEL_RCSID(0, $NetBSD: lfs_vnops.c,v 1.232 2010/12/18 00:01:46 eeh Exp $); #ifdef _KERNEL_OPT #include opt_compat_netbsd.h @@ -2205,16 +2205,19 @@ * Pagedaemon can't actually write LFS pages; wake up * the writer to take care of that. The writer will * notice the pager inode queue and act on that. + * + * XXX We must drop the vp-interlock before taking the lfs_lock or we + * get a nasty deadlock with lfs_flush_pchain(). */ if (pagedaemon) { + mutex_exit(vp-v_interlock); mutex_enter(lfs_lock); if (!(ip-i_flags IN_PAGING)) { ip-i_flags |= IN_PAGING; TAILQ_INSERT_TAIL(fs-lfs_pchainhd, ip, i_lfs_pchain); - } + } wakeup(lfs_writer_daemon); mutex_exit(lfs_lock); - mutex_exit(vp-v_interlock); preempt(); return EWOULDBLOCK; }
CVS commit: src/sys/kern
Module Name:src Committed By: eeh Date: Thu Dec 16 00:42:22 UTC 2010 Modified Files: src/sys/kern: init_main.c Log Message: ubc_init needs to run while we're still cold or uvmhist breaks. To generate a diff of this commit: cvs rdiff -u -r1.423 -r1.424 src/sys/kern/init_main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/init_main.c diff -u src/sys/kern/init_main.c:1.423 src/sys/kern/init_main.c:1.424 --- src/sys/kern/init_main.c:1.423 Sat Aug 21 13:17:31 2010 +++ src/sys/kern/init_main.c Thu Dec 16 00:42:22 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: init_main.c,v 1.423 2010/08/21 13:17:31 pgoyette Exp $ */ +/* $NetBSD: init_main.c,v 1.424 2010/12/16 00:42:22 eeh Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: init_main.c,v 1.423 2010/08/21 13:17:31 pgoyette Exp $); +__KERNEL_RCSID(0, $NetBSD: init_main.c,v 1.424 2010/12/16 00:42:22 eeh Exp $); #include opt_ddb.h #include opt_ipsec.h @@ -502,12 +502,12 @@ ssp_init(); + ubc_init(); /* must be after autoconfig */ + configure2(); /* Now timer is working. Enable preemption. */ kpreempt_enable(); - ubc_init(); /* must be after autoconfig */ - #ifdef SYSVSHM /* Initialize System V style shared memory. */ shminit();
CVS commit: src/sys/arch/sparc/stand/bootblk
Module Name:src Committed By: eeh Date: Thu Jun 24 00:54:12 UTC 2010 Modified Files: src/sys/arch/sparc/stand/bootblk: bootblk.fth Log Message: indir-block needs to be the size of a filesystem block or bad things can happen. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc/stand/bootblk/bootblk.fth Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc/stand/bootblk/bootblk.fth diff -u src/sys/arch/sparc/stand/bootblk/bootblk.fth:1.12 src/sys/arch/sparc/stand/bootblk/bootblk.fth:1.13 --- src/sys/arch/sparc/stand/bootblk/bootblk.fth:1.12 Thu Mar 11 19:28:55 2010 +++ src/sys/arch/sparc/stand/bootblk/bootblk.fth Thu Jun 24 00:54:12 2010 @@ -1,4 +1,4 @@ -\ $NetBSD: bootblk.fth,v 1.12 2010/03/11 19:28:55 eeh Exp $ +\ $NetBSD: bootblk.fth,v 1.13 2010/06/24 00:54:12 eeh Exp $ \ \ IEEE 1275 Open Firmware Boot Block \ @@ -343,7 +343,7 @@ \ Assume UFS2 dinodes are always biger than UFS1 ufs2_dinode_SIZEOF buffer: cur-inode -h# 2000 buffer: indir-block +0 value indir-block create indir-addr -1 , -1 , \ @@ -747,6 +747,7 @@ abort then dup to cur-blocksize alloc-mem to cur-block\ Allocate cur-block + cur-blocksize alloc-mem to indir-block boot-debug? if . ufs-open complete cr then ; @@ -755,7 +756,8 @@ cif-close -1 to boot-ihandle then cur-block 0 if - cur-block cur-blocksize free-mem + cur-block cur-blocksize free-mem + indir-block cur-blocksize free-mem then ; @@ -888,7 +890,7 @@ : do-boot ( bootfile -- ) . NetBSD IEEE 1275 Multi-FS Bootblock cr - . Version $NetBSD: bootblk.fth,v 1.12 2010/03/11 19:28:55 eeh Exp $ cr + . Version $NetBSD: bootblk.fth,v 1.13 2010/06/24 00:54:12 eeh Exp $ cr boot-path load-file ( -- load-base ) dup 0 if init-program evaluate then ;
CVS commit: src/sys/arch/sparc/stand/bootblk
Module Name:src Committed By: eeh Date: Wed Feb 17 15:49:19 UTC 2010 Modified Files: src/sys/arch/sparc/stand/bootblk: bootblk.fth Log Message: Fix ffsv2 support. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sparc/stand/bootblk/bootblk.fth Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc/stand/bootblk/bootblk.fth diff -u src/sys/arch/sparc/stand/bootblk/bootblk.fth:1.10 src/sys/arch/sparc/stand/bootblk/bootblk.fth:1.11 --- src/sys/arch/sparc/stand/bootblk/bootblk.fth:1.10 Sat Feb 13 23:38:17 2010 +++ src/sys/arch/sparc/stand/bootblk/bootblk.fth Wed Feb 17 15:49:19 2010 @@ -1,4 +1,4 @@ -\ $NetBSD: bootblk.fth,v 1.10 2010/02/13 23:38:17 eeh Exp $ +\ $NetBSD: bootblk.fth,v 1.11 2010/02/17 15:49:19 eeh Exp $ \ \ IEEE 1275 Open Firmware Boot Block \ @@ -35,6 +35,8 @@ false value boot-debug? +: KB d# 1024 * ; + \ \ First some housekeeping: Open /chosen and set up vectors into \ client-services @@ -610,6 +612,7 @@ endcase then ( sb ) \ The FFS magic is at the end of the superblock + \ XXX we should check to make sure this is not an alternate SB. fs_magic l@ case fs1_magic_value of init-ffs-v1 true endof fs2_magic_value of init-ffs-v2 true endof @@ -688,6 +691,26 @@ then ; +: check-supers ( -- found? ) + \ Superblocks used to be 8KB into the partition, but ffsv2 changed that. + \ See comments in src/sys/ufs/ffs/fs.h + \ Put a list of offets to check on the stack, ending with -1 + -1 + 0 + d# 128 KB + d# 64 KB + 8 KB + + begin dup -1 while ( -1 .. off ) + raid-offset dev_bsize * + read-super ( -1 .. ) + sb-buf fs-magic? if ( -1 .. ) + begin -1 = until \ Clean out extra stuff from stack + true exit + then + repeat + drop false +; + : ufs-open ( bootpath len -- ) boot-ihandle -1 = if 2dup + 0 swap c! \ Nul terminate. @@ -700,13 +723,12 @@ 2drop boot-debug? if . Try a RAID superblock read cr then - rf_protected dup to raid-offset - dev_bsize * sboff + read-super - sb-buf fs-magic? invert if + \ RAIDFRAME skips 64 sectors. + d# 64 to raid-offset + check-supers invert if boot-debug? if . Try a normal superblock read cr then 0 to raid-offset - sboff read-super - sb-buf fs-magic? invert abort Invalid superblock magic + check-supers 0= abort Invalid superblock magic then sb-buf fs-bsize l@ dup maxbsize if . Superblock bsize space . . too large cr @@ -857,9 +879,10 @@ ; : do-boot ( bootfile -- ) -. NetBSD IEEE 1275 Multi-FS Bootblock cr -boot-path load-file ( -- load-base ) -dup 0 if init-program evaluate then + . NetBSD IEEE 1275 Multi-FS Bootblock cr + . Version $NetBSD: bootblk.fth,v 1.11 2010/02/17 15:49:19 eeh Exp $ cr + boot-path load-file ( -- load-base ) + dup 0 if init-program evaluate then ;
CVS commit: src/sys/arch/sparc/stand/ofwboot
Module Name:src Committed By: eeh Date: Wed Feb 17 15:50:06 UTC 2010 Modified Files: src/sys/arch/sparc/stand/ofwboot: ofdev.c Log Message: Add support for ffsv2 and lfs. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/arch/sparc/stand/ofwboot/ofdev.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc/stand/ofwboot/ofdev.c diff -u src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.25 src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.26 --- src/sys/arch/sparc/stand/ofwboot/ofdev.c:1.25 Wed Jan 27 22:18:37 2010 +++ src/sys/arch/sparc/stand/ofwboot/ofdev.c Wed Feb 17 15:50:06 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ofdev.c,v 1.25 2010/01/27 22:18:37 martin Exp $ */ +/* $NetBSD: ofdev.c,v 1.26 2010/02/17 15:50:06 eeh Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -41,6 +41,7 @@ #include lib/libsa/stand.h #include lib/libsa/ufs.h +#include lib/libsa/lfs.h #include lib/libsa/cd9660.h #ifdef NETBOOT #include lib/libsa/nfs.h @@ -188,8 +189,10 @@ }; int ndevs = sizeof ofdevsw / sizeof ofdevsw[0]; + #ifdef SPARC_BOOT_UFS -static struct fs_ops file_system_ufs = FS_OPS(ufs); +static struct fs_ops file_system_ufs[] = +{ FS_OPS(ufs), FS_OPS(ffsv2), FS_OPS(lfsv1), FS_OPS(lfsv2) }; #endif #ifdef SPARC_BOOT_CD9660 static struct fs_ops file_system_cd9660 = FS_OPS(cd9660); @@ -199,7 +202,7 @@ static struct fs_ops file_system_tftp = FS_OPS(tftp); #endif -struct fs_ops file_system[3]; +struct fs_ops file_system[7]; int nfsys; static struct of_dev ofdev = { @@ -515,11 +518,13 @@ of-f_dev = ofdevsw; of-f_devdata = ofdev; #ifdef SPARC_BOOT_UFS - memcpy(file_system[nfsys++], file_system_ufs, sizeof file_system[0]); + memcpy(file_system[nfsys++], file_system_ufs[0], sizeof file_system[0]); + memcpy(file_system[nfsys++], file_system_ufs[1], sizeof file_system[0]); + memcpy(file_system[nfsys++], file_system_ufs[2], sizeof file_system[0]); + memcpy(file_system[nfsys++], file_system_ufs[3], sizeof file_system[0]); #endif #ifdef SPARC_BOOT_CD9660 - memcpy(file_system[nfsys++], file_system_cd9660, - sizeof file_system[0]); + memcpy(file_system[nfsys++], file_system_cd9660, sizeof file_system[0]); #endif DPRINTF((devopen: return 0\n)); return 0;
CVS commit: src/sys/ufs/lfs
Module Name:src Committed By: eeh Date: Thu Feb 18 01:14:01 UTC 2010 Modified Files: src/sys/ufs/lfs: lfs_vfsops.c Log Message: Fix root filesystem support. To generate a diff of this commit: cvs rdiff -u -r1.283 -r1.284 src/sys/ufs/lfs/lfs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/lfs/lfs_vfsops.c diff -u src/sys/ufs/lfs/lfs_vfsops.c:1.283 src/sys/ufs/lfs/lfs_vfsops.c:1.284 --- src/sys/ufs/lfs/lfs_vfsops.c:1.283 Tue Feb 16 23:20:30 2010 +++ src/sys/ufs/lfs/lfs_vfsops.c Thu Feb 18 01:14:00 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_vfsops.c,v 1.283 2010/02/16 23:20:30 mlelstv Exp $ */ +/* $NetBSD: lfs_vfsops.c,v 1.284 2010/02/18 01:14:00 eeh Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007 @@ -61,7 +61,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: lfs_vfsops.c,v 1.283 2010/02/16 23:20:30 mlelstv Exp $); +__KERNEL_RCSID(0, $NetBSD: lfs_vfsops.c,v 1.284 2010/02/18 01:14:00 eeh Exp $); #if defined(_KERNEL_OPT) #include opt_lfs.h @@ -516,8 +516,10 @@ lfs_mountroot(void) { extern struct vnode *rootvp; + struct lfs *fs = NULL;/* LFS */ struct mount *mp; struct lwp *l = curlwp; + struct ufsmount *ump; int error; if (device_class(root_device) != DV_DISK) @@ -537,6 +539,10 @@ mutex_enter(mountlist_lock); CIRCLEQ_INSERT_TAIL(mountlist, mp, mnt_list); mutex_exit(mountlist_lock); + ump = VFSTOUFS(mp); + fs = ump-um_lfs; + memset(fs-lfs_fsmnt, 0, sizeof(fs-lfs_fsmnt)); + (void)copystr(mp-mnt_stat.f_mntonname, fs-lfs_fsmnt, MNAMELEN - 1, 0); (void)lfs_statvfs(mp, mp-mnt_stat); vfs_unbusy(mp, false, NULL); setrootfstime((time_t)(VFSTOUFS(mp)-um_lfs-lfs_tstamp)); @@ -597,8 +603,15 @@ * used for our initial mount */ ump = VFSTOUFS(mp); - if (devvp != ump-um_devvp) -error = EINVAL; + if (devvp != ump-um_devvp) { +if (devvp-v_rdev != ump-um_devvp-v_rdev) + error = EINVAL; +else { + vrele(devvp); + devvp = ump-um_devvp; + vref(devvp); +} + } } } else { if (!update) {
CVS commit: src/sys/arch/sparc/stand/bootblk
Module Name:src Committed By: eeh Date: Sat Feb 13 23:38:17 UTC 2010 Modified Files: src/sys/arch/sparc/stand/bootblk: Makefile bootblk.fth genfth.cf Added Files: src/sys/arch/sparc/stand/bootblk: genlfs.cf Log Message: Major overhaul: 1) Add support for multiple filesystems including ffsv1, ffsv2, lfsv1 and lfsv2. (ffsv1 and lfsv2 are known to work. ffv2 support needs more work. lfsv1 is probably untested.) 2) Only 32-bit Fcodes are used. All 64-bit math uses two cells. This means it should work on 32-bit machines. Additional work to consider: 1) Rename genfth.cf to genffs.cf, or keep it and move the ffs symbols to genffs.cf 2) Move the ffs code and the lfs code to different source files so you can selectively fload the just the filesystems you want. 3) Add code to load ELF files directly instead of relying on the host firmware ELF support. But, since the binary is now 7250 bytes there may not be room. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc/stand/bootblk/Makefile cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc/stand/bootblk/bootblk.fth cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc/stand/bootblk/genfth.cf cvs rdiff -u -r0 -r1.1 src/sys/arch/sparc/stand/bootblk/genlfs.cf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/sparc/stand/bootblk/Makefile diff -u src/sys/arch/sparc/stand/bootblk/Makefile:1.12 src/sys/arch/sparc/stand/bootblk/Makefile:1.13 --- src/sys/arch/sparc/stand/bootblk/Makefile:1.12 Mon Apr 6 12:43:26 2009 +++ src/sys/arch/sparc/stand/bootblk/Makefile Sat Feb 13 23:38:17 2010 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.12 2009/04/06 12:43:26 tsutsui Exp $ +# $NetBSD: Makefile,v 1.13 2010/02/13 23:38:17 eeh Exp $ CURDIR= ${.CURDIR} S= ${CURDIR}/../../../.. @@ -10,7 +10,7 @@ PROG= bootblk SRCS= bootblk.fth OBJS= -CLEANFILES= assym.fth.h assym.fth.h.tmp machine sparc \ +CLEANFILES= ffs.fth.h lfs.fth.h assym.fth.h.tmp machine sparc \ bootblk bootblk.text bootblk.text.tmp NOMAN= # defined @@ -32,17 +32,22 @@ machine: ln -s ${.CURDIR}/../../../${MACHINE}/include machine -assym.fth.h: genfth.cf machine sparc +ffs.fth.h: genfth.cf machine sparc ${TOOL_GENASSYM} -f -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ - ${.CURDIR}/genfth.cf assym.fth.h.tmp \ - mv -f assym.fth.h.tmp assym.fth.h + ${.CURDIR}/genfth.cf ffs.fth.h.tmp \ + mv -f ffs.fth.h.tmp ffs.fth.h -bootblk.text: bootblk.fth assym.fth.h +lfs.fth.h: genlfs.cf machine sparc + ${TOOL_GENASSYM} -f -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ + ${.CURDIR}/genlfs.cf lfs.fth.h.tmp \ + mv -f lfs.fth.h.tmp lfs.fth.h + +bootblk.text: bootblk.fth ffs.fth.h lfs.fth.h ${TOOL_AWK} '/fload/ { print #include \ $$2 \ }; !/fload/' \ ${.CURDIR}/bootblk.fth | /usr/bin/cpp -P bootblk.text.tmp mv -f bootblk.text.tmp bootblk.text -bootblk: bootblk.fth assym.fth.h +bootblk: bootblk.fth ffs.fth.h lfs.fth.h ${TOOL_FGEN} -o bootblk ${.CURDIR}/bootblk.fth beforedepend: Index: src/sys/arch/sparc/stand/bootblk/bootblk.fth diff -u src/sys/arch/sparc/stand/bootblk/bootblk.fth:1.9 src/sys/arch/sparc/stand/bootblk/bootblk.fth:1.10 --- src/sys/arch/sparc/stand/bootblk/bootblk.fth:1.9 Mon Oct 19 18:12:37 2009 +++ src/sys/arch/sparc/stand/bootblk/bootblk.fth Sat Feb 13 23:38:17 2010 @@ -1,11 +1,11 @@ -\ $NetBSD: bootblk.fth,v 1.9 2009/10/19 18:12:37 snj Exp $ +\ $NetBSD: bootblk.fth,v 1.10 2010/02/13 23:38:17 eeh Exp $ \ \ IEEE 1275 Open Firmware Boot Block \ \ Parses disklabel and UFS and loads the file called `ofwboot' \ \ -\ Copyright (c) 1998 Eduardo Horvath. +\ Copyright (c) 1998-2010 Eduardo Horvath. \ All rights reserved. \ \ Redistribution and use in source and binary forms, with or without @@ -55,15 +55,15 @@ \ defer cif-peer ( phandle -- phandle ) \ defer cif-getprop ( len adr cstr phandle -- ) -: find-cif-method ( method,len -- xf ) +: find-cif-method ( method len -- xf ) cif-phandle find-method drop ; - claim find-cif-method to cif-claim - open find-cif-method to cif-open - close find-cif-method to cif-close - read find-cif-method to cif-read - seek find-cif-method to cif-seek + claim find-cif-method to cif-claim + open find-cif-method to cif-open + close find-cif-method to cif-close + read find-cif-method to cif-read + seek find-cif-method to cif-seek : twiddle ( -- ) . . ; \ Need to do this right. Just spit out periods for now. @@ -71,8 +71,49 @@ \ Support routines \ +\ 64-bit math support + +here h# over l! w@ constant little-endian? +: uld ( l -- d.lo d.hi ) 0 ; +: ld ( l -- d.lo d.hi ) dup 0 if -1 else 0 then ; +: dl ( d.lo d.hi -- l ) drop ; +: d@ ( addr -- d.lo d.hi ) dup l@ swap la1+ l@ little-endian? invert if swap then ; +: d! ( d.lo d.hi addr -- ) + little-endian? invert if -rot swap rot then tuck la1+ l! l! ; +: d-and ( d1 d2 -- d1-and-d2 ) rot
CVS commit: src/usr.bin/fgen
Module Name:src Committed By: eeh Date: Mon Feb 8 20:14:55 UTC 2010 Modified Files: src/usr.bin/fgen: fgen.h fgen.l Log Message: Some bugfixes and enhancements. Support for case .. of and fix calculation of branch offsets. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.bin/fgen/fgen.h cvs rdiff -u -r1.33 -r1.34 src/usr.bin/fgen/fgen.l 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/fgen/fgen.h diff -u src/usr.bin/fgen/fgen.h:1.8 src/usr.bin/fgen/fgen.h:1.9 --- src/usr.bin/fgen/fgen.h:1.8 Mon Oct 19 18:12:37 2009 +++ src/usr.bin/fgen/fgen.h Mon Feb 8 20:14:55 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: fgen.h,v 1.8 2009/10/19 18:12:37 snj Exp $ */ +/* $NetBSD: fgen.h,v 1.9 2010/02/08 20:14:55 eeh Exp $ */ /* * fgen.h -- stuff for the fcode tokenizer. * @@ -38,8 +38,8 @@ #define TOKEN struct tok #define YY_DECL TOKEN* yylex(void) -#define FCODE 0xF00DBABE -#define MACRO 0xFEEDBABE +#define FCODE 0x000FC0DE +#define MACRO 0xF00D /* Defined fcode and string. */ struct fcode { @@ -82,12 +82,12 @@ TOK_PSTRING, TOK_TOKENIZE, TOK_COMMENT, - TOK_ENDCOMMENT, TOK_COLON, TOK_SEMICOLON, TOK_TOSTRING, /* These are special */ + TOK_ABORT_S, TOK_AGAIN, TOK_ALIAS, TOK_GETTOKEN, @@ -101,9 +101,12 @@ TOK_DEFER, TOK_DO, TOK_ELSE, + TOK_END0, TOK_ENDCASE, TOK_ENDOF, TOK_EXTERNAL, + TOK_FCODE_VERSION2, + TOK_FCODE_END, TOK_FIELD, TOK_HEADERLESS, TOK_HEADERS, @@ -111,14 +114,16 @@ TOK_LEAVE, TOK_LOOP, TOK_OF, + TOK_OFFSET16, TOK_REPEAT, + TOK_STARTX, TOK_THEN, TOK_TO, TOK_UNTIL, TOK_VALUE, TOK_VARIABLE, + TOK_VERSION1, TOK_WHILE, - TOK_OFFSET16, /* Tokenizer directives */ TOK_BEGTOK, Index: src/usr.bin/fgen/fgen.l diff -u src/usr.bin/fgen/fgen.l:1.33 src/usr.bin/fgen/fgen.l:1.34 --- src/usr.bin/fgen/fgen.l:1.33 Thu Oct 29 14:49:03 2009 +++ src/usr.bin/fgen/fgen.l Mon Feb 8 20:14:55 2010 @@ -1,5 +1,5 @@ %{ -/* $NetBSD: fgen.l,v 1.33 2009/10/29 14:49:03 christos Exp $ */ +/* $NetBSD: fgen.l,v 1.34 2010/02/08 20:14:55 eeh Exp $ */ /* FLEX input for FORTH input file scanner */ /* * Copyright (c) 1998 Eduardo Horvath. @@ -42,16 +42,15 @@ #endif #if defined(__RCSID) !defined(lint) -__RCSID($NetBSD: fgen.l,v 1.33 2009/10/29 14:49:03 christos Exp $); +__RCSID($NetBSD: fgen.l,v 1.34 2010/02/08 20:14:55 eeh Exp $); #endif %} -%option yylineno noinput +%option yylineno -decimal [0-9.] -hex [0-9A-Fa-f.] -octal [0-7.] +hex [0-9A-Fa-f] +hexdot [0-9A-Fa-f.] white [ \t\n\r\f] tail {white} @@ -90,6 +89,7 @@ int offsetsize = 8; int defining = 0; int tokenizer = 0; +int need_end0 = 1; #define PSTKSIZ 1024 Cell parse_stack[PSTKSIZ]; @@ -101,7 +101,8 @@ int debug = 0; #define ASSERT if (debug) assert -#define STATE(y, x) do { if (debug) printf( %ld State %s: token `%s'\n, outpos, x, y); } while (0) +#define STATE(y, x) do { if (debug) printf( %lx State %s: token `%s'\n, outpos, x, y); } while (0) +int mark_fload = 0; %} @@ -125,7 +126,7 @@ \\[^\n]*\n /* end of line comment -- keep looping */ { STATE(yytext, EOL comment); } --?{hex}+ { ltoken.type = TOK_NUMBER; ltoken.text = yytext; +-?{hex}{hexdot}* { ltoken.type = TOK_NUMBER; ltoken.text = yytext; return ltoken; } \'.\' { ltoken.type = TOK_C_LIT; ltoken.text = yytext; return ltoken; } @@ -139,10 +140,10 @@ \.\{white}*(\\\|[^])*\ { ltoken.type = TOK_PSTRING; ltoken.text = yytext; return ltoken; } -( { ltoken.type = TOK_COMMENT; ltoken.text = yytext; -return ltoken; } +[aA][bB][oO][rR][tT]\{white}*(\\\|[^])*\ { ltoken.type = TOK_ABORT_S; +ltoken.text = yytext; return ltoken; } -) { ltoken.type = TOK_ENDCOMMENT; ltoken.text = yytext; +( { ltoken.type = TOK_COMMENT; ltoken.text = yytext; return ltoken; } : { ltoken.type = TOK_COLON; ltoken.text = yytext; @@ -199,6 +200,9 @@ [eE][lL][sS][eE] { ltoken.type = TOK_ELSE; ltoken.text = yytext; return ltoken; } +[eE][nN][dD]0 { ltoken.type = TOK_END0; ltoken.text = yytext; +return ltoken; } + [eE][nN][dD][cC][aA][sS][eE] { ltoken.type = TOK_ENDCASE; ltoken.text = yytext; return ltoken; } @@ -208,6 +212,13 @@ [eE][xX][tT][eE][rR][nN][aA][lL] { ltoken.type = TOK_EXTERNAL; ltoken.text = yytext; return ltoken; } +[fF][cC][oO][dD][eE]-[vV][eE][rR][sS][iI][oO][nN]2 { + ltoken.type = TOK_FCODE_VERSION2; ltoken.text = yytext; +return ltoken; } + +[fF][cC][oO][dD][eE]-[eE][nN][dD] { ltoken.type = TOK_FCODE_END; ltoken.text = yytext; +return ltoken; } + [fF][iI][eE][lL][dD] { ltoken.type = TOK_FIELD; ltoken.text = yytext; return ltoken; } @@ -241,9 +252,15 @@ [oO][fF] { ltoken.type = TOK_OF; ltoken.text = yytext; return ltoken; } +[oO][fF][fF][sS][eE][tT]16 { ltoken.type = TOK_OFFSET16; ltoken.text = yytext; +return ltoken; } + [rR][eE][pP][eE][aA][tT] { ltoken.type = TOK_REPEAT
CVS commit: src/sys/gdbscripts
Module Name:src Committed By: eeh Date: Wed Nov 18 18:04:26 UTC 2009 Modified Files: src/sys/gdbscripts: vchain Log Message: Print out all 64-bits of 64-bit values on 64-bit machines and add documentation of these commands to gdb. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/gdbscripts/vchain Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/gdbscripts/vchain diff -u src/sys/gdbscripts/vchain:1.5 src/sys/gdbscripts/vchain:1.6 --- src/sys/gdbscripts/vchain:1.5 Sat Nov 4 20:33:17 2006 +++ src/sys/gdbscripts/vchain Wed Nov 18 18:04:26 2009 @@ -1,32 +1,39 @@ -# $NetBSD: vchain,v 1.5 2006/11/04 20:33:17 pooka Exp $ +# $NetBSD: vchain,v 1.6 2009/11/18 18:04:26 eeh Exp $ # @(#)vchain 8.1 (Berkeley) 6/10/93 # -# Given a vnode, follow its mount pointers + define vchain set $num = 0 set $vp=(struct vnode *)$arg0 while ($vp) - printf vp: 0x%x freelist_next: 0x%x usecount: %d flags: 0x%x\n, $vp, $vp-v_freelist.tqe_next, $vp-v_uobj.uo_refs, $vp-v_flag + printf vp: 0x%lx freelist_next: 0x%lx usecount: %d flags: i:0x%x v:0x%x u:0x%x\n,\ + $vp, $vp-v_freelist.tqe_next, $vp-v_uobj.uo_refs, \ + $vp-v_iflag, $vp-v_vflag, $vp-v_uflag set $num++ set $vp = $vp-v_mntvnodes.tqe_next end printf Number of vnodes: %d\n, $num end +document vchain +Given a vnode, follow its mount pointers +end + define vprint set $vp=(struct vnode *)$arg0 set $ip=(struct inode *)$vp-v_data end -# print the vnode chain for a given mount point define mp_vchain set $mp = (struct mount *)$arg0 vchain $mp-mnt_vnodelist.tqh_first end +document mp_vchain +print the vnode chain for a given mount point +end -# print vnode chains for all mount points define vall set $mp=mountlist.cqh_first while ($mp) @@ -40,6 +47,9 @@ end end end +document vall +print vnode chains for all mount points +end define mountdump set $mp=mountlist.cqh_first @@ -52,3 +62,4 @@ set $mp = 0 end end +end \ No newline at end of file
CVS commit: src/sys/gdbscripts
Module Name:src Committed By: eeh Date: Wed Nov 18 18:05:51 UTC 2009 Modified Files: src/sys/gdbscripts: procs Log Message: Add the lwp address so you don't have to leave gdb and use ps to grab an lwp's stack. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/gdbscripts/procs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/gdbscripts/procs diff -u src/sys/gdbscripts/procs:1.1 src/sys/gdbscripts/procs:1.2 --- src/sys/gdbscripts/procs:1.1 Wed Feb 20 20:56:35 2008 +++ src/sys/gdbscripts/procs Wed Nov 18 18:05:51 2009 @@ -1,4 +1,4 @@ -# $NetBSD: procs,v 1.1 2008/02/20 20:56:35 ad Exp $ +# $NetBSD: procs,v 1.2 2009/11/18 18:05:51 eeh Exp $ define procs set $i = 0 @@ -8,12 +8,12 @@ set $p = allproc.lh_first end if ($p) - printf proc pid flag stat nlwps comm\n + printf proc pid flag stat nlwpslwp comm\n end while ($p) - printf %16lx %5d %8x %4x %5d %s, \ + printf %16lx %5d %8x %4x %5d %16lx %s, \ $p, $p-p_pid, \ -$p-p_flag, $p-p_stat, $p-p_nlwps, \ +$p-p_flag, $p-p_stat, $p-p_nlwps, $p-p_lwps.lh_first, \ (char *) $p-p_comm printf \n set $p = $p-p_list.le_next
CVS commit: src/sys/gdbscripts
Module Name:src Committed By: eeh Date: Wed Nov 18 18:12:00 UTC 2009 Modified Files: src/sys/gdbscripts: lwps Log Message: Add a command to dump all thread stacks in the system and a command to dump lockdebug state. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/gdbscripts/lwps Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/gdbscripts/lwps diff -u src/sys/gdbscripts/lwps:1.2 src/sys/gdbscripts/lwps:1.3 --- src/sys/gdbscripts/lwps:1.2 Tue Jul 28 10:38:20 2009 +++ src/sys/gdbscripts/lwps Wed Nov 18 18:12:00 2009 @@ -1,4 +1,4 @@ -# $NetBSD: lwps,v 1.2 2009/07/28 10:38:20 skrll Exp $ +# $NetBSD: lwps,v 1.3 2009/11/18 18:12:00 eeh Exp $ define lwps set $i = 0 @@ -14,10 +14,12 @@ set $l = $p-p_lwps.lh_first set $j = 0 while ($j $p-p_nlwps) -printf %16lx %5d %5d %8x %16lx, \ +printf 0x%16lx %5d %5d %8x 0x%16lx, \ $l, $p-p_pid, $l-l_lid, $l-l_flag, $l-l_wchan if ($l-l_wmesg) printf (%s), (char *)$l-l_wmesg +# If the preceding command cannot dereference the pointer, use this instead: +# printf (%lx), $l-l_wmesg end set $l = $l-l_sibling.le_next printf \n @@ -28,3 +30,95 @@ set $i++ end end +document lwps +ps for lwps +end + +define threadlist + set $i = 0 + + while ($i 2) + if ($i == 0) + set $p = allproc.lh_first + end + while ($p) + set $l = $p-p_lwps.lh_first + set $j = 0 + while ($j $p-p_nlwps) + printf \n + printf proc: %16lx %5d %8x %4x %5d %16lx %s, \ +$p, $p-p_pid, \ +$p-p_flag, $p-p_stat, $p-p_nlwps, $p-p_lwps.lh_first, \ +(char *) $p-p_comm + printf \n +printf Thread: %16lx %5d %5d %8x %16lx\n, \ + $l, $p-p_pid, $l-l_lid, $l-l_flag, $l-l_wchan + kvm proc $l +where + printf \n + printf \n +set $l = $l-l_sibling.le_next +set $j++ + end + set $p = $p-p_list.le_next + end + set $i++ + end +end +document threadlist +Print out the stack of all threads in the system. +end + +define lock + set $ld = (struct lockdebug *)ld_rb_tree + set $a = $ld-ld_lock + set $b = (volatile void *)$arg0 + + while ($ld $a != $b) + if ($a $b) + set $ld = (struct lockdebug *)$ld-ld_rb_node.rb_nodes[1] + end + if ($a $b) + set $ld = (struct lockdebug *)$ld-ld_rb_node.rb_nodes[0] + end + if ($ld == 0) + loop_break + end + set $a = $ld-ld_lock +# printf a=%lx b=%lx ld=%lx ab %d ab %d\n, $a, $b, $ld, ($a $b), ($a $b) + end + if ($ld) + printf lock address : %#018lx type : , \ + (long)$ld-ld_lock + if ($ld-ld_flags 0x2) + printf sleep/adaptive\n + else + printf spin\n + end + printf initialized : %#018lx, \ + (long)$ld-ld_initaddr + if ($ld-ld_lockops-lo_type == 0x2) + printf interlock: %#018lx\n, $ld-ld_locked + else + printf \n + printf shared holds : %18u exclusive: , \ +$ld-ld_shares + if (($ld-ld_flags 0x1) != 0) +printf 1\n + else +printf 0\n + end + printf shares wanted: %18u exclusive: %18u\n, \ +(unsigned)$ld-ld_shwant, (unsigned)$ld-ld_exwant + printf cpu last held: %18u\n, \ +(unsigned)$ld-ld_cpu + printf current lwp : %#018lx last held: %#018lx\n, \ +(long)0, (long)$ld-ld_lwp + printf last locked : %#018lx unlocked : %#018lx\n, \ +(long)$ld-ld_locked, (long)$ld-ld_unlocked + end + end +end +document lock +Print out lockdebug info like ddb does. +end
CVS commit: src/sys/ufs/lfs
Module Name:src Committed By: eeh Date: Thu Oct 29 18:20:11 UTC 2009 Modified Files: src/sys/ufs/lfs: lfs_vfsops.c Log Message: Fix up numoutput accounting. To generate a diff of this commit: cvs rdiff -u -r1.278 -r1.279 src/sys/ufs/lfs/lfs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/lfs/lfs_vfsops.c diff -u src/sys/ufs/lfs/lfs_vfsops.c:1.278 src/sys/ufs/lfs/lfs_vfsops.c:1.279 --- src/sys/ufs/lfs/lfs_vfsops.c:1.278 Sun Sep 13 05:17:37 2009 +++ src/sys/ufs/lfs/lfs_vfsops.c Thu Oct 29 18:20:11 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_vfsops.c,v 1.278 2009/09/13 05:17:37 tsutsui Exp $ */ +/* $NetBSD: lfs_vfsops.c,v 1.279 2009/10/29 18:20:11 eeh Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007 @@ -61,7 +61,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: lfs_vfsops.c,v 1.278 2009/09/13 05:17:37 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: lfs_vfsops.c,v 1.279 2009/10/29 18:20:11 eeh Exp $); #if defined(_KERNEL_OPT) #include opt_lfs.h @@ -1678,10 +1678,6 @@ UVMPAGER_MAPIN_WAITOK); } - mutex_enter(vp-v_interlock); - vp-v_numoutput += 2; /* one for biodone, one for aiodone */ - mutex_exit(vp-v_interlock); - mbp = getiobuf(NULL, true); UVMHIST_LOG(ubchist, vp %p mbp %p num now %d bytes 0x%x, vp, mbp, vp-v_numoutput, bytes); @@ -1738,9 +1734,14 @@ /* if it's really one i/o, don't make a second buf */ if (offset == startoffset iobytes == bytes) { bp = mbp; - /* correct overcount if there is no second buffer */ + /* + * All the LFS output is done by the segwriter. It + * will increment numoutput by one for all the bufs it + * recieves. However this buffer needs one extra to + * account for aiodone. + */ mutex_enter(vp-v_interlock); - --vp-v_numoutput; + vp-v_numoutput++; mutex_exit(vp-v_interlock); } else { bp = getiobuf(NULL, true); @@ -1754,15 +1755,6 @@ * converted this to use nestiobuf --pooka */ bp-b_flags = ~B_ASYNC; - /* - * LFS uses VOP_BWRITE instead of VOP_STRATEGY. - * Therefore biodone doesn't get called for - * the buffer. Therefore decrement the output - * counter that nestiobuf_setup() incremented. - */ - mutex_enter(vp-v_interlock); - vp-v_numoutput--; - mutex_exit(vp-v_interlock); } /* XXX This is silly ... is this necessary? */