Pass lwp pointers throughtout the kernel, as required, so that the lwpid can trunk
authordarrenr <darrenr@NetBSD.org>
Sat, 28 Jun 2003 14:20:43 +0000
branchtrunk
changeset 114222 a08ef4a8ddfe
parent 114221 10299d9d2d73
child 114223 b78e408d70dc
Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed. Bump the kernel rev up to 1.6V
sys/altq/altq_conf.h
sys/arch/algor/algor/bus_dma.c
sys/arch/alpha/alpha/syscall.c
sys/arch/alpha/common/bus_dma.c
sys/arch/alpha/common/sgmap_typedep.c
sys/arch/amiga/amiga/machdep.c
sys/arch/arc/arc/bus_dma.c
sys/arch/arc/jazz/bus_dma_jazz.c
sys/arch/arm/arm/syscall.c
sys/arch/arm/arm32/bus_dma.c
sys/arch/atari/atari/bus.c
sys/arch/atari/atari/machdep.c
sys/arch/cesfic/cesfic/machdep.c
sys/arch/cobalt/cobalt/bus.c
sys/arch/evbppc/evbppc/bus_dma.c
sys/arch/hp300/dev/sd.c
sys/arch/hp300/hp300/hpux_machdep.c
sys/arch/hp300/hp300/machdep.c
sys/arch/hp300/include/hpux_machdep.h
sys/arch/hpc/hpc/kloader.c
sys/arch/hpcmips/hpcmips/bus_dma.c
sys/arch/i386/conf/GENERIC
sys/arch/i386/i386/apm.c
sys/arch/i386/i386/machdep.c
sys/arch/i386/i386/mem.c
sys/arch/i386/i386/process_machdep.c
sys/arch/i386/i386/procfs_machdep.c
sys/arch/i386/i386/syscall.c
sys/arch/i386/i386/vm_machdep.c
sys/arch/i386/include/ptrace.h
sys/arch/luna68k/luna68k/machdep.c
sys/arch/m68k/m68k/bus_dma.c
sys/arch/m68k/m68k/m68k_syscall.c
sys/arch/mac68k/mac68k/machdep.c
sys/arch/macppc/macppc/bus_dma.c
sys/arch/mips/mips/bus_dma.c
sys/arch/mips/mips/cpu_exec.c
sys/arch/mips/mips/trap.c
sys/arch/mipsco/mipsco/bus_dma.c
sys/arch/mvme68k/mvme68k/bus_dma.c
sys/arch/mvme68k/mvme68k/machdep.c
sys/arch/news68k/news68k/machdep.c
sys/arch/newsmips/newsmips/bus.c
sys/arch/next68k/next68k/machdep.c
sys/arch/pc532/pc532/machdep.c
sys/arch/playstation2/playstation2/bus_dma.c
sys/arch/playstation2/playstation2/kloader.c
sys/arch/pmax/pmax/bus_dma.c
sys/arch/powerpc/marvell/bus_dma.c
sys/arch/powerpc/powerpc/bus_dma.c
sys/arch/powerpc/powerpc/process_machdep.c
sys/arch/powerpc/powerpc/syscall.c
sys/arch/sgimips/sgimips/bus.c
sys/arch/sh3/sh3/coff_exec.c
sys/arch/sh3/sh3/exception.c
sys/arch/sh5/sh5/bus_dma.c
sys/arch/sh5/sh5/syscall.c
sys/arch/sparc/sparc/machdep.c
sys/arch/sparc/sparc/trap.c
sys/arch/sparc64/sparc64/machdep.c
sys/arch/sparc64/sparc64/mem.c
sys/arch/sparc64/sparc64/trap.c
sys/arch/sun2/sun2/machdep.c
sys/arch/sun3/sun3/machdep.c
sys/arch/sun3/sun3x/machdep.c
sys/arch/vax/vax/bus_dma.c
sys/arch/vax/vax/trap.c
sys/arch/vax/vax/vm_machdep.c
sys/arch/x68k/x68k/bus.c
sys/arch/x68k/x68k/machdep.c
sys/arch/x86/x86/bus_dma.c
sys/arch/x86/x86/bus_machdep.c
sys/arch/x86_64/x86_64/syscall.c
sys/coda/coda_psdev.c
sys/coda/coda_venus.c
sys/coda/coda_venus.h
sys/coda/coda_vfsops.c
sys/coda/coda_vfsops.h
sys/coda/coda_vnops.c
sys/coda/coda_vnops.h
sys/compat/aout/aout_misc.c
sys/compat/aoutm68k/aoutm68k_misc.c
sys/compat/aoutm68k/aoutm68k_stat.c
sys/compat/common/compat_file.c
sys/compat/common/compat_util.c
sys/compat/common/compat_util.h
sys/compat/common/kern_info_09.c
sys/compat/common/kern_info_43.c
sys/compat/common/tty_43.c
sys/compat/common/uipc_syscalls_43.c
sys/compat/common/vfs_syscalls_12.c
sys/compat/common/vfs_syscalls_43.c
sys/compat/darwin/darwin_exec.c
sys/compat/darwin/darwin_exec.h
sys/compat/darwin/darwin_mman.c
sys/compat/darwin/darwin_sysctl.c
sys/compat/darwin/darwin_sysctl.h
sys/compat/freebsd/freebsd_exec.h
sys/compat/freebsd/freebsd_exec_aout.c
sys/compat/freebsd/freebsd_exec_elf32.c
sys/compat/freebsd/freebsd_file.c
sys/compat/freebsd/freebsd_ioctl.c
sys/compat/freebsd/freebsd_misc.c
sys/compat/hpux/hpux_compat.c
sys/compat/hpux/hpux_exec.c
sys/compat/hpux/hpux_exec.h
sys/compat/hpux/hpux_exec_aout.c
sys/compat/hpux/hpux_file.c
sys/compat/ibcs2/ibcs2_exec.h
sys/compat/ibcs2/ibcs2_exec_coff.c
sys/compat/ibcs2/ibcs2_exec_elf32.c
sys/compat/ibcs2/ibcs2_exec_xout.c
sys/compat/ibcs2/ibcs2_fcntl.c
sys/compat/ibcs2/ibcs2_ioctl.c
sys/compat/ibcs2/ibcs2_misc.c
sys/compat/ibcs2/ibcs2_stat.c
sys/compat/irix/irix_dirent.c
sys/compat/irix/irix_exec.h
sys/compat/irix/irix_exec_elf32.c
sys/compat/irix/irix_mount.c
sys/compat/irix/irix_stat.c
sys/compat/linux/arch/i386/linux_machdep.c
sys/compat/linux/common/linux_blkio.c
sys/compat/linux/common/linux_cdrom.c
sys/compat/linux/common/linux_exec.c
sys/compat/linux/common/linux_exec.h
sys/compat/linux/common/linux_exec_aout.c
sys/compat/linux/common/linux_exec_elf32.c
sys/compat/linux/common/linux_fdio.c
sys/compat/linux/common/linux_file.c
sys/compat/linux/common/linux_file64.c
sys/compat/linux/common/linux_hdio.c
sys/compat/linux/common/linux_ioctl.c
sys/compat/linux/common/linux_ioctl.h
sys/compat/linux/common/linux_misc.c
sys/compat/linux/common/linux_misc_notalpha.c
sys/compat/linux/common/linux_socket.c
sys/compat/linux/common/linux_sysctl.c
sys/compat/linux/common/linux_termios.c
sys/compat/linux/common/linux_uselib.c
sys/compat/m68k4k/m68k4k_exec.c
sys/compat/m68k4k/m68k4k_exec.h
sys/compat/mach/mach_exec.c
sys/compat/mach/mach_exec.h
sys/compat/mach/mach_message.c
sys/compat/mach/mach_vm.c
sys/compat/netbsd32/netbsd32_compat_12.c
sys/compat/netbsd32/netbsd32_compat_43.c
sys/compat/netbsd32/netbsd32_exec.h
sys/compat/netbsd32/netbsd32_exec_aout.c
sys/compat/netbsd32/netbsd32_exec_elf32.c
sys/compat/netbsd32/netbsd32_execve.c
sys/compat/netbsd32/netbsd32_fs.c
sys/compat/netbsd32/netbsd32_socket.c
sys/compat/osf1/osf1_exec.h
sys/compat/osf1/osf1_exec_ecoff.c
sys/compat/osf1/osf1_file.c
sys/compat/osf1/osf1_mount.c
sys/compat/ossaudio/ossaudio.c
sys/compat/ossaudio/ossaudio.h
sys/compat/pecoff/pecoff_exec.c
sys/compat/pecoff/pecoff_exec.h
sys/compat/pecoff/pecoff_misc.c
sys/compat/sunos/sunos_exec.h
sys/compat/sunos/sunos_exec_aout.c
sys/compat/sunos/sunos_misc.c
sys/compat/sunos32/sunos32_exec.h
sys/compat/sunos32/sunos32_exec_aout.c
sys/compat/sunos32/sunos32_misc.c
sys/compat/svr4/svr4_exec.h
sys/compat/svr4/svr4_exec_elf32.c
sys/compat/svr4/svr4_exec_elf64.c
sys/compat/svr4/svr4_fcntl.c
sys/compat/svr4/svr4_filio.c
sys/compat/svr4/svr4_misc.c
sys/compat/svr4/svr4_net.c
sys/compat/svr4/svr4_sockio.c
sys/compat/svr4/svr4_stat.c
sys/compat/svr4/svr4_stream.c
sys/compat/svr4/svr4_termios.c
sys/compat/svr4/svr4_ttold.c
sys/compat/svr4_32/svr4_32_exec.h
sys/compat/svr4_32/svr4_32_exec_elf32.c
sys/compat/svr4_32/svr4_32_fcntl.c
sys/compat/svr4_32/svr4_32_filio.c
sys/compat/svr4_32/svr4_32_misc.c
sys/compat/svr4_32/svr4_32_sockio.c
sys/compat/svr4_32/svr4_32_stat.c
sys/compat/svr4_32/svr4_32_termios.c
sys/compat/ultrix/ultrix_pathname.c
sys/compat/vax1k/vax1k_exec.c
sys/compat/vax1k/vax1k_exec.h
sys/conf/osrelease.sh
sys/ddb/db_variables.c
sys/ddb/db_xxx.c
sys/ddb/ddbvar.h
sys/dev/acpi/acpica/Osd/OsdSchedule.c
sys/dev/ata/ld_ataraid.c
sys/dev/ata/wd.c
sys/dev/audio.c
sys/dev/audio_if.h
sys/dev/ccd.c
sys/dev/cgd.c
sys/dev/clockctl.c
sys/dev/cons.c
sys/dev/dksubr.c
sys/dev/dkvar.h
sys/dev/dmover/dmover_io.c
sys/dev/i2o/dpti.c
sys/dev/i2o/iop.c
sys/dev/ic/com.c
sys/dev/ic/cy.c
sys/dev/ic/dpt.c
sys/dev/ic/joy.c
sys/dev/ic/lpt.c
sys/dev/ic/mlx.c
sys/dev/ic/rrunner.c
sys/dev/ic/vga.c
sys/dev/ic/vgavar.h
sys/dev/ieee1394/fwohci.c
sys/dev/ieee1394/ieee1394var.h
sys/dev/ieee1394/sbp2.c
sys/dev/ir/cirvar.h
sys/dev/ir/irframe.c
sys/dev/ir/irframe_tty.c
sys/dev/ir/irframevar.h
sys/dev/isa/fd.c
sys/dev/isa/mcd.c
sys/dev/isa/pcdisplay.c
sys/dev/isa/spkr.c
sys/dev/kttcp.c
sys/dev/ld.c
sys/dev/mca/ed_mca.c
sys/dev/md.c
sys/dev/midi.c
sys/dev/midi_if.h
sys/dev/midisyn.c
sys/dev/midisynvar.h
sys/dev/mm.c
sys/dev/pci/agp.c
sys/dev/pci/bktr/bktr_core.c
sys/dev/pci/bktr/bktr_core.h
sys/dev/pci/bktr/bktr_os.c
sys/dev/pci/cz.c
sys/dev/pci/if_wi_pci.c
sys/dev/pci/machfb.c
sys/dev/pci/mly.c
sys/dev/pci/oboe.c
sys/dev/pci/pci_usrreq.c
sys/dev/pci/pcivar.h
sys/dev/pci/twe.c
sys/dev/pci/vga_pci.c
sys/dev/radio.c
sys/dev/raidframe/rf_copyback.c
sys/dev/raidframe/rf_disks.c
sys/dev/raidframe/rf_kintf.h
sys/dev/raidframe/rf_netbsdkintf.c
sys/dev/raidframe/rf_reconstruct.c
sys/dev/rnd.c
sys/dev/scsipi/cd.c
sys/dev/scsipi/ch.c
sys/dev/scsipi/scsiconf.c
sys/dev/scsipi/scsipi_ioctl.c
sys/dev/scsipi/scsipiconf.h
sys/dev/scsipi/sd.c
sys/dev/scsipi/ses.c
sys/dev/scsipi/ss.c
sys/dev/scsipi/st.c
sys/dev/scsipi/uk.c
sys/dev/sequencer.c
sys/dev/sysmon/sysmon.c
sys/dev/sysmon/sysmon_envsys.c
sys/dev/sysmon/sysmon_power.c
sys/dev/sysmon/sysmon_wdog.c
sys/dev/sysmon/sysmonvar.h
sys/dev/usb/ubtbcmfw.c
sys/dev/usb/ucom.c
sys/dev/usb/ugen.c
sys/dev/usb/uhid.c
sys/dev/usb/uirda.c
sys/dev/usb/ulpt.c
sys/dev/usb/urio.c
sys/dev/usb/usb.c
sys/dev/usb/uscanner.c
sys/dev/usb/ustir.c
sys/dev/verified_exec.c
sys/dev/vnd.c
sys/dev/wscons/wsdisplay.c
sys/dev/wscons/wsdisplay_compat_usl.c
sys/dev/wscons/wsdisplayvar.h
sys/dev/wscons/wsevent.c
sys/dev/wscons/wseventvar.h
sys/dev/wscons/wskbd.c
sys/dev/wscons/wsmouse.c
sys/dev/wscons/wsmux.c
sys/dev/wscons/wsmuxvar.h
sys/dev/wsfont/wsfontdev.c
sys/fs/adosfs/adlookup.c
sys/fs/adosfs/advfsops.c
sys/fs/cd9660/cd9660_extern.h
sys/fs/cd9660/cd9660_lookup.c
sys/fs/cd9660/cd9660_node.c
sys/fs/cd9660/cd9660_node.h
sys/fs/cd9660/cd9660_vfsops.c
sys/fs/cd9660/cd9660_vnops.c
sys/fs/filecorefs/filecore_extern.h
sys/fs/filecorefs/filecore_lookup.c
sys/fs/filecorefs/filecore_vfsops.c
sys/fs/msdosfs/denode.h
sys/fs/msdosfs/msdosfs_denode.c
sys/fs/msdosfs/msdosfs_lookup.c
sys/fs/msdosfs/msdosfs_vfsops.c
sys/fs/msdosfs/msdosfs_vnops.c
sys/fs/ntfs/ntfs.h
sys/fs/ntfs/ntfs_subr.c
sys/fs/ntfs/ntfs_vfsops.c
sys/fs/ntfs/ntfs_vfsops.h
sys/fs/ntfs/ntfs_vnops.c
sys/fs/smbfs/smbfs.h
sys/fs/smbfs/smbfs_io.c
sys/fs/smbfs/smbfs_kq.c
sys/fs/smbfs/smbfs_node.c
sys/fs/smbfs/smbfs_vfsops.c
sys/fs/smbfs/smbfs_vnops.c
sys/kern/core_elf32.c
sys/kern/core_netbsd.c
sys/kern/exec_aout.c
sys/kern/exec_conf.c
sys/kern/exec_ecoff.c
sys/kern/exec_elf32.c
sys/kern/exec_macho.c
sys/kern/exec_script.c
sys/kern/exec_subr.c
sys/kern/init_main.c
sys/kern/kern_acct.c
sys/kern/kern_descrip.c
sys/kern/kern_event.c
sys/kern/kern_exec.c
sys/kern/kern_exit.c
sys/kern/kern_fork.c
sys/kern/kern_ksyms.c
sys/kern/kern_ktrace.c
sys/kern/kern_lkm.c
sys/kern/kern_sig.c
sys/kern/kern_subr.c
sys/kern/kern_synch.c
sys/kern/kern_sysctl.c
sys/kern/kern_systrace.c
sys/kern/subr_log.c
sys/kern/sys_generic.c
sys/kern/sys_pipe.c
sys/kern/sys_process.c
sys/kern/sys_socket.c
sys/kern/sysv_sem.c
sys/kern/tty.c
sys/kern/tty_conf.c
sys/kern/tty_pty.c
sys/kern/tty_tty.c
sys/kern/uipc_domain.c
sys/kern/uipc_sem.c
sys/kern/uipc_socket.c
sys/kern/uipc_socket2.c
sys/kern/uipc_syscalls.c
sys/kern/uipc_usrreq.c
sys/kern/vfs_cache.c
sys/kern/vfs_getcwd.c
sys/kern/vfs_lookup.c
sys/kern/vfs_subr.c
sys/kern/vfs_syscalls.c
sys/kern/vfs_vnops.c
sys/kern/vnode_if.c
sys/kern/vnode_if.sh
sys/kern/vnode_if.src
sys/lkm/netinet/if_ipl/mln_ipl.c
sys/miscfs/fdesc/fdesc.h
sys/miscfs/fdesc/fdesc_vfsops.c
sys/miscfs/fdesc/fdesc_vnops.c
sys/miscfs/fifofs/fifo_vnops.c
sys/miscfs/genfs/genfs_vnops.c
sys/miscfs/genfs/layer_extern.h
sys/miscfs/genfs/layer_subr.c
sys/miscfs/genfs/layer_vfsops.c
sys/miscfs/kernfs/kernfs_vfsops.c
sys/miscfs/kernfs/kernfs_vnops.c
sys/miscfs/nullfs/null_vfsops.c
sys/miscfs/overlay/overlay_vfsops.c
sys/miscfs/portal/portal_vfsops.c
sys/miscfs/portal/portal_vnops.c
sys/miscfs/procfs/procfs.h
sys/miscfs/procfs/procfs_cmdline.c
sys/miscfs/procfs/procfs_ctl.c
sys/miscfs/procfs/procfs_fd.c
sys/miscfs/procfs/procfs_fpregs.c
sys/miscfs/procfs/procfs_linux.c
sys/miscfs/procfs/procfs_map.c
sys/miscfs/procfs/procfs_mem.c
sys/miscfs/procfs/procfs_note.c
sys/miscfs/procfs/procfs_regs.c
sys/miscfs/procfs/procfs_status.c
sys/miscfs/procfs/procfs_subr.c
sys/miscfs/procfs/procfs_vfsops.c
sys/miscfs/procfs/procfs_vnops.c
sys/miscfs/specfs/spec_vnops.c
sys/miscfs/syncfs/sync_subr.c
sys/miscfs/syncfs/sync_vnops.c
sys/miscfs/umapfs/umap_vfsops.c
sys/net/bpf.c
sys/net/if.c
sys/net/if.h
sys/net/if_tun.c
sys/net/raw_cb.h
sys/net/raw_usrreq.c
sys/net/route.c
sys/net/route.h
sys/net/rtsock.c
sys/netatalk/at_extern.h
sys/netatalk/ddp_usrreq.c
sys/netccitt/pk_acct.c
sys/netccitt/pk_extern.h
sys/netccitt/pk_usrreq.c
sys/netinet/ip_fil.c
sys/netinet/ip_fil.h
sys/netinet/ip_var.h
sys/netinet/raw_ip.c
sys/netinet/tcp_usrreq.c
sys/netinet/tcp_var.h
sys/netinet/udp_usrreq.c
sys/netinet/udp_var.h
sys/netinet6/ip6_var.h
sys/netinet6/ip6protosw.h
sys/netinet6/raw_ip6.c
sys/netinet6/udp6_usrreq.c
sys/netinet6/udp6_var.h
sys/netiso/clnp.h
sys/netiso/clnp_raw.c
sys/netiso/cltp_usrreq.c
sys/netiso/cltp_var.h
sys/netiso/esis.c
sys/netiso/esis.h
sys/netiso/idrp_usrreq.c
sys/netiso/idrp_var.h
sys/netiso/iso.c
sys/netiso/iso_snpac.c
sys/netiso/iso_var.h
sys/netiso/tp_usrreq.c
sys/netiso/tp_var.h
sys/netkey/keysock.c
sys/netkey/keysock.h
sys/netnatm/natm.c
sys/netnatm/natm.h
sys/netns/idp_usrreq.c
sys/netns/idp_var.h
sys/netns/spp_usrreq.c
sys/netns/spp_var.h
sys/netsmb/smb_conn.h
sys/netsmb/smb_dev.c
sys/netsmb/smb_iod.c
sys/netsmb/smb_rq.c
sys/netsmb/smb_subr.c
sys/netsmb/smb_subr.h
sys/netsmb/smb_tran.h
sys/netsmb/smb_trantcp.c
sys/nfs/nfs.h
sys/nfs/nfs_bio.c
sys/nfs/nfs_boot.c
sys/nfs/nfs_bootdhcp.c
sys/nfs/nfs_bootparam.c
sys/nfs/nfs_kq.c
sys/nfs/nfs_node.c
sys/nfs/nfs_nqlease.c
sys/nfs/nfs_serv.c
sys/nfs/nfs_socket.c
sys/nfs/nfs_subs.c
sys/nfs/nfs_syscalls.c
sys/nfs/nfs_var.h
sys/nfs/nfs_vfsops.c
sys/nfs/nfs_vnops.c
sys/nfs/nfsdiskless.h
sys/nfs/nfsm_subs.h
sys/nfs/nfsmount.h
sys/nfs/nqnfs.h
sys/sys/acct.h
sys/sys/clockctl.h
sys/sys/conf.h
sys/sys/event.h
sys/sys/exec.h
sys/sys/exec_aout.h
sys/sys/exec_coff.h
sys/sys/exec_ecoff.h
sys/sys/exec_elf.h
sys/sys/exec_macho.h
sys/sys/exec_script.h
sys/sys/file.h
sys/sys/filedesc.h
sys/sys/ktrace.h
sys/sys/mount.h
sys/sys/namei.h
sys/sys/param.h
sys/sys/proc.h
sys/sys/protosw.h
sys/sys/ptrace.h
sys/sys/select.h
sys/sys/sem.h
sys/sys/socketvar.h
sys/sys/sysctl.h
sys/sys/systm.h
sys/sys/tty.h
sys/sys/uio.h
sys/sys/un.h
sys/sys/verified_exec.h
sys/sys/vnode.h
sys/sys/vnode_if.h
sys/ufs/ext2fs/ext2fs_alloc.c
sys/ufs/ext2fs/ext2fs_extern.h
sys/ufs/ext2fs/ext2fs_inode.c
sys/ufs/ext2fs/ext2fs_lookup.c
sys/ufs/ext2fs/ext2fs_readwrite.c
sys/ufs/ext2fs/ext2fs_vfsops.c
sys/ufs/ext2fs/ext2fs_vnops.c
sys/ufs/ffs/ffs_alloc.c
sys/ufs/ffs/ffs_extern.h
sys/ufs/ffs/ffs_inode.c
sys/ufs/ffs/ffs_softdep.c
sys/ufs/ffs/ffs_softdep.stub.c
sys/ufs/ffs/ffs_vfsops.c
sys/ufs/ffs/ffs_vnops.c
sys/ufs/lfs/lfs_alloc.c
sys/ufs/lfs/lfs_extern.h
sys/ufs/lfs/lfs_inode.c
sys/ufs/lfs/lfs_segment.c
sys/ufs/lfs/lfs_syscalls.c
sys/ufs/lfs/lfs_vfsops.c
sys/ufs/lfs/lfs_vnops.c
sys/ufs/mfs/mfs_extern.h
sys/ufs/mfs/mfs_vfsops.c
sys/ufs/mfs/mfs_vnops.c
sys/ufs/ufs/quota.h
sys/ufs/ufs/ufs_extern.h
sys/ufs/ufs/ufs_ihash.c
sys/ufs/ufs/ufs_inode.c
sys/ufs/ufs/ufs_lookup.c
sys/ufs/ufs/ufs_quota.c
sys/ufs/ufs/ufs_readwrite.c
sys/ufs/ufs/ufs_vfsops.c
sys/ufs/ufs/ufs_vnops.c
sys/uvm/uvm_extern.h
sys/uvm/uvm_glue.c
sys/uvm/uvm_meter.c
sys/uvm/uvm_mmap.c
sys/uvm/uvm_swap.c
sys/uvm/uvm_vnode.c
--- a/sys/altq/altq_conf.h	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/altq/altq_conf.h	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: altq_conf.h,v 1.4 2002/09/06 13:18:43 gehenna Exp $	*/
+/*	$NetBSD: altq_conf.h,v 1.5 2003/06/28 14:20:43 darrenr Exp $	*/
 /*	$KAME: altq_conf.h,v 1.6 2001/01/29 19:59:09 itojun Exp $	*/
 
 /*
@@ -52,9 +52,9 @@
 #endif
 
 #if defined(__NetBSD__) || defined(__OpenBSD__)
-typedef int d_open_t __P((dev_t, int, int, struct proc *));
-typedef int d_close_t __P((dev_t, int, int, struct proc *));
-typedef int d_ioctl_t __P((dev_t, u_long, caddr_t, int, struct proc *));
+typedef int d_open_t __P((dev_t, int, int, struct lwp *));
+typedef int d_close_t __P((dev_t, int, int, struct lwp *));
+typedef int d_ioctl_t __P((dev_t, u_long, caddr_t, int, struct lwp *));
 #endif /* __NetBSD__ || __OpenBSD__ */
 
 #if defined(__OpenBSD__)
@@ -62,9 +62,9 @@
 #define	noclose	(dev_type_close((*))) enodev
 #define	noioctl	(dev_type_ioctl((*))) enodev
 
-int altqopen __P((dev_t, int, int, struct proc *));
-int altqclose __P((dev_t, int, int, struct proc *));
-int altqioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
+int altqopen __P((dev_t, int, int, struct lwp *));
+int altqclose __P((dev_t, int, int, struct lwp *));
+int altqioctl __P((dev_t, u_long, caddr_t, int, struct lwp *));
 #endif
 
 /*
--- a/sys/arch/algor/algor/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/algor/algor/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.7 2003/04/01 02:15:24 thorpej Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.8 2003/06/28 14:20:44 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.7 2003/04/01 02:15:24 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.8 2003/06/28 14:20:44 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -332,7 +332,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: "
--- a/sys/arch/alpha/alpha/syscall.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/alpha/alpha/syscall.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.c,v 1.7 2003/01/17 22:11:18 thorpej Exp $ */
+/* $NetBSD: syscall.c,v 1.8 2003/06/28 14:20:45 darrenr Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.7 2003/01/17 22:11:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.8 2003/06/28 14:20:45 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -366,7 +366,7 @@
 #ifdef KTRACE
 	if (KTRPOINT(p, KTR_SYSRET)) {
 		KERNEL_PROC_LOCK(l);
-		ktrsysret(p, SYS_fork, 0, 0);
+		ktrsysret(l, SYS_fork, 0, 0);
 		KERNEL_PROC_UNLOCK(l);
 	}
 #endif
--- a/sys/arch/alpha/common/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/alpha/common/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.53 2003/04/09 23:32:03 thorpej Exp $ */
+/* $NetBSD: bus_dma.c,v 1.54 2003/06/28 14:20:45 darrenr Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.53 2003/04/09 23:32:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.54 2003/06/28 14:20:45 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -372,7 +372,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio_direct: "
--- a/sys/arch/alpha/common/sgmap_typedep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/alpha/common/sgmap_typedep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sgmap_typedep.c,v 1.25 2003/05/03 18:10:42 wiz Exp $ */
+/* $NetBSD: sgmap_typedep.c,v 1.26 2003/06/28 14:20:45 darrenr Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-__KERNEL_RCSID(0, "$NetBSD: sgmap_typedep.c,v 1.25 2003/05/03 18:10:42 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sgmap_typedep.c,v 1.26 2003/06/28 14:20:45 darrenr Exp $");
 
 #include "opt_ddb.h"
 
@@ -326,7 +326,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic(__S(__C(SGMAP_TYPE,_load_uio))
--- a/sys/arch/amiga/amiga/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/amiga/amiga/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.182 2003/06/23 11:01:05 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.183 2003/06/28 14:20:46 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -50,7 +50,7 @@
 #include "opt_panicbutton.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.182 2003/06/23 11:01:05 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.183 2003/06/28 14:20:46 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1603,8 +1603,8 @@
  * MID and proceed to new zmagic code ;-)
  */
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	int error = ENOEXEC;
@@ -1615,7 +1615,7 @@
 #ifdef COMPAT_NOMID
 	if (!((execp->a_midmag >> 16) & 0x0fff)
 	    && execp->a_midmag == ZMAGIC)
-		return(exec_aout_prep_zmagic(p, epp));
+		return(exec_aout_prep_zmagic(l->l_proc, epp));
 #endif
 	return(error);
 }
--- a/sys/arch/arc/arc/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/arc/arc/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.14 2003/04/01 22:37:25 thorpej Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.15 2003/06/28 14:20:47 darrenr Exp $	*/
 /*	NetBSD: bus_dma.c,v 1.20 2000/01/10 03:24:36 simonb Exp 	*/
 
 /*-
@@ -360,7 +360,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/arc/jazz/bus_dma_jazz.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/arc/jazz/bus_dma_jazz.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma_jazz.c,v 1.5 2003/02/10 14:58:37 tsutsui Exp $	*/
+/*	$NetBSD: bus_dma_jazz.c,v 1.6 2003/06/28 14:20:47 darrenr Exp $	*/
 
 /*-
  * Copyright (C) 2003 Izumi Tsutsui.
@@ -290,8 +290,8 @@
 	if (error == 0) {
 		error = jazz_bus_dmamap_alloc_sgmap(t, map->dm_segs,
 		    map->dm_nsegs, map->_dm_boundary,
-		    uio->uio_segflg == UIO_USERSPACE ? uio->uio_procp : NULL,
-		    flags);
+		    uio->uio_segflg == UIO_USERSPACE ? uio->uio_lwp->l_proc :
+		    NULL, flags);
 	}
 	return (error);
 }
--- a/sys/arch/arm/arm/syscall.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/arm/arm/syscall.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: syscall.c,v 1.16 2003/03/01 04:36:38 thorpej Exp $	*/
+/*	$NetBSD: syscall.c,v 1.17 2003/06/28 14:20:47 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
@@ -82,7 +82,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.16 2003/03/01 04:36:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.17 2003/06/28 14:20:47 darrenr Exp $");
 
 #include <sys/device.h>
 #include <sys/errno.h>
@@ -454,7 +454,7 @@
 #ifdef KTRACE
 	if (KTRPOINT(p, KTR_SYSRET)) {
 		KERNEL_PROC_LOCK(p);
-		ktrsysret(p, SYS_fork, 0, 0);
+		ktrsysret(l, SYS_fork, 0, 0);
 		KERNEL_PROC_UNLOCK(p);
 	}
 #endif
--- a/sys/arch/arm/arm32/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/arm/arm32/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.30 2003/05/21 18:04:42 thorpej Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.31 2003/06/28 14:20:48 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -336,7 +336,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/atari/atari/bus.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/atari/atari/bus.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.33 2003/04/01 23:47:02 thorpej Exp $	*/
+/*	$NetBSD: bus.c,v 1.34 2003/06/28 14:20:48 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -522,7 +522,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/atari/atari/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/atari/atari/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.125 2003/06/23 11:01:10 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.126 2003/06/28 14:20:49 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -979,8 +979,8 @@
  * MID and proceed to new zmagic code ;-)
  */
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	int error = ENOEXEC;
@@ -991,7 +991,7 @@
 #ifdef COMPAT_NOMID
 	if (!((execp->a_midmag >> 16) & 0x0fff)
 	    && execp->a_midmag == ZMAGIC)
-		return(exec_aout_prep_zmagic(p, epp));
+		return(exec_aout_prep_zmagic(l->l_proc, epp));
 #endif
 	return(error);
 }
--- a/sys/arch/cesfic/cesfic/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/cesfic/cesfic/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.18 2003/06/23 11:01:12 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.19 2003/06/28 14:20:49 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -760,8 +760,8 @@
  *	done on little-endian machines...  -- cgd
  */
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 #if defined(COMPAT_NOMID) || defined(COMPAT_44)
@@ -779,7 +779,7 @@
 	switch (midmag) {
 #ifdef COMPAT_NOMID
 	case (MID_ZERO << 16) | ZMAGIC:
-		error = exec_aout_prep_oldzmagic(p, epp);
+		error = exec_aout_prep_oldzmagic(l->l_proc, epp);
 		return (error);
 #endif
 #ifdef COMPAT_44
--- a/sys/arch/cobalt/cobalt/bus.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/cobalt/cobalt/bus.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.14 2003/04/02 03:39:59 thorpej Exp $	*/
+/*	$NetBSD: bus.c,v 1.15 2003/06/28 14:20:50 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -412,7 +412,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/evbppc/evbppc/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/evbppc/evbppc/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.2 2003/04/08 23:12:20 thorpej Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.3 2003/06/28 14:20:50 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -299,7 +299,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/hp300/dev/sd.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/hp300/dev/sd.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: sd.c,v 1.61 2003/05/03 18:10:48 wiz Exp $	*/
+/*	$NetBSD: sd.c,v 1.62 2003/06/28 14:20:50 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.61 2003/05/03 18:10:48 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.62 2003/06/28 14:20:50 darrenr Exp $");
 
 #include "rnd.h"
 #include "opt_useleds.h"
@@ -1036,7 +1036,7 @@
 	int pid;
 
 	if ((pid = sc->sc_format_pid) >= 0 &&
-	    pid != uio->uio_procp->p_pid)
+	    pid != uio->uio_lwp->l_proc->p_pid)
 		return (EPERM);
 		
 	return (physio(sdstrategy, NULL, dev, B_READ, minphys, uio));
@@ -1053,7 +1053,7 @@
 	int pid;
 
 	if ((pid = sc->sc_format_pid) >= 0 &&
-	    pid != uio->uio_procp->p_pid)
+	    pid != uio->uio_lwp->l_proc->p_pid)
 		return (EPERM);
 		
 	return (physio(sdstrategy, NULL, dev, B_WRITE, minphys, uio));
--- a/sys/arch/hp300/hp300/hpux_machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/hp300/hp300/hpux_machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpux_machdep.c,v 1.32 2003/01/17 22:53:08 thorpej Exp $	*/
+/*	$NetBSD: hpux_machdep.c,v 1.33 2003/06/28 14:20:51 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpux_machdep.c,v 1.32 2003/01/17 22:53:08 thorpej Exp $");                                                  
+__KERNEL_RCSID(0, "$NetBSD: hpux_machdep.c,v 1.33 2003/06/28 14:20:51 darrenr Exp $");                                                  
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -168,8 +168,8 @@
  * m68k-specific setup for HP-UX executables.
  */
 int
-hpux_cpu_makecmds(p, epp)
-	struct proc *p;
+hpux_cpu_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	/* struct hpux_exec *hpux_ep = epp->ep_hdr; */
--- a/sys/arch/hp300/hp300/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/hp300/hp300/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.169 2003/06/23 11:01:14 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.170 2003/06/28 14:20:51 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.169 2003/06/23 11:01:14 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.170 2003/06/28 14:20:51 darrenr Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_hpux.h"
@@ -1327,8 +1327,8 @@
  *	done on little-endian machines...  -- cgd
  */
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 #if defined(COMPAT_NOMID) || defined(COMPAT_44)
@@ -1346,12 +1346,12 @@
 	switch (midmag) {
 #ifdef COMPAT_NOMID
 	case (MID_ZERO << 16) | ZMAGIC:
-		error = exec_aout_prep_oldzmagic(p, epp);
+		error = exec_aout_prep_oldzmagic(l->l_proc, epp);
 		return(error);
 #endif
 #ifdef COMPAT_44
 	case (MID_HP300 << 16) | ZMAGIC:
-		error = exec_aout_prep_oldzmagic(p, epp);
+		error = exec_aout_prep_oldzmagic(l->l_proc, epp);
 		return(error);
 #endif
 	}
--- a/sys/arch/hp300/include/hpux_machdep.h	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/hp300/include/hpux_machdep.h	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpux_machdep.h,v 1.13 2003/01/17 22:53:07 thorpej Exp $	*/
+/*	$NetBSD: hpux_machdep.h,v 1.14 2003/06/28 14:20:52 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
 struct exec_package;
 struct exec_vmcmd;
 
-int	hpux_cpu_makecmds __P((struct proc *, struct exec_package *));
+int	hpux_cpu_makecmds __P((struct lwp *, struct exec_package *));
 int	hpux_cpu_vmcmd __P((struct proc *, struct exec_vmcmd *));
 int	hpux_cpu_sysconf_arch __P((void));
 int	hpux_to_bsd_uoff __P((int *, int *, struct lwp *));
--- a/sys/arch/hpc/hpc/kloader.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/hpc/hpc/kloader.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: kloader.c,v 1.4 2002/06/02 14:44:44 drochner Exp $	*/
+/*	$NetBSD: kloader.c,v 1.5 2003/06/28 14:20:52 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -309,10 +309,9 @@
 struct vnode *
 kloader_open(const char *filename)
 {
-	struct proc *p = KLOADER_PROC;
 	struct nameidata nid;
 
-	NDINIT(&nid, LOOKUP, FOLLOW, UIO_SYSSPACE, filename, p);
+	NDINIT(&nid, LOOKUP, FOLLOW, UIO_SYSSPACE, filename, curlwp);
 
 	if (namei(&nid) != 0) {
 		PRINTF("namei failed (%s)\n", filename);
--- a/sys/arch/hpcmips/hpcmips/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/hpcmips/hpcmips/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.17 2003/04/02 03:58:11 thorpej Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.18 2003/06/28 14:20:53 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -329,7 +329,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_hpcmips_bd_map_load_uio: USERSPACE but no proc");
--- a/sys/arch/i386/conf/GENERIC	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/i386/conf/GENERIC	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.561 2003/05/29 20:22:28 fvdl Exp $
+# $NetBSD: GENERIC,v 1.562 2003/06/28 14:20:53 darrenr Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.561 $"
+#ident 		"GENERIC-$Revision: 1.562 $"
 
 maxusers	32		# estimated number of users
 
@@ -98,11 +98,11 @@
 #options 	NEW_BUFQ_STRATEGY
 
 # Diagnostic/debugging support options
-#options 	DIAGNOSTIC	# expensive kernel consistency checks
-#options 	DEBUG		# expensive debugging checks/support
+options 	DIAGNOSTIC	# expensive kernel consistency checks
+options 	DEBUG		# expensive debugging checks/support
 #options 	KMEMSTATS	# kernel memory statistics (vmstat -m)
 options 	DDB		# in-kernel debugger
-#options 	DDB_ONPANIC=1	# see also sysctl(8): `ddb.onpanic'
+options 	DDB_ONPANIC=1	# see also sysctl(8): `ddb.onpanic'
 options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
 #options 	KGDB		# remote debugger
 #options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
@@ -119,17 +119,17 @@
 options 	COMPAT_15	# NetBSD 1.5
 options 	COMPAT_43	# 4.3BSD, 386BSD, and BSDI
 options 	COMPAT_386BSD_MBRPART # recognize old partition ID
-#options 	TCP_COMPAT_42	# 4.2BSD TCP/IP bug compat. Not recommended.
+options 	TCP_COMPAT_42	# 4.2BSD TCP/IP bug compat. Not recommended.
 
 options 	COMPAT_OSSAUDIO	# OSS (Voxware) audio driver compatibility
 options 	COMPAT_SVR4	# binary compatibility with SVR4
 options 	COMPAT_IBCS2	# binary compatibility with SCO and ISC
 options 	COMPAT_LINUX	# binary compatibility with Linux
 options 	COMPAT_FREEBSD	# binary compatibility with FreeBSD
-#options 	COMPAT_MACH	# binary compatibility with Mach binaries
-#options 	COMPAT_DARWIN	# binary compatibility with Darwin binaries
-#options 	EXEC_MACHO	# exec MACH-O binaries
-#options 	COMPAT_PECOFF	# kernel support to run Win32 apps
+options 	COMPAT_MACH	# binary compatibility with Mach binaries
+options 	COMPAT_DARWIN	# binary compatibility with Darwin binaries
+options 	EXEC_MACHO	# exec MACH-O binaries
+options 	COMPAT_PECOFF	# kernel support to run Win32 apps
 
 # File systems
 file-system 	FFS		# UFS
@@ -153,24 +153,24 @@
 
 # File system options
 options 	QUOTA		# UFS quotas
-#options 	FFS_EI		# FFS Endian Independent support
+options 	FFS_EI		# FFS Endian Independent support
 options 	SOFTDEP		# FFS soft updates support.
 options 	NFSSERVER	# Network File System server
-#options 	EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
+options 	EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
 				# immutable) behave as system flags.
 
 # Networking options
 #options 	GATEWAY		# packet forwarding
 options 	INET		# IP + ICMP + TCP + UDP
 options 	INET6		# IPV6
-#options 	IPSEC		# IP security
-#options 	IPSEC_ESP	# IP security (encryption part; define w/IPSEC)
+options 	IPSEC		# IP security
+options 	IPSEC_ESP	# IP security (encryption part; define w/IPSEC)
 #options 	IPSEC_DEBUG	# debug for IP security
-#options 	MROUTING	# IP multicast routing
+options 	MROUTING	# IP multicast routing
 options 	NS		# XNS
-#options 	NSIP		# XNS tunneling over IP
+options 	NSIP		# XNS tunneling over IP
 options 	ISO,TPIP	# OSI
-#options 	EON		# OSI tunneling over IP
+options 	EON		# OSI tunneling over IP
 options 	CCITT,LLC,HDLC	# X.25
 options 	NETATALK	# AppleTalk networking protocols
 options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
@@ -241,12 +241,12 @@
 mainbus0 at root
 
 cpu* at mainbus?
-#ioapic* at mainbus?
+ioapic* at mainbus?
 
 # Doesn't do anything yet.
-#p64h2apic* at pci? dev? function?	# P64H2 IOxAPIC
+p64h2apic* at pci? dev? function?	# P64H2 IOxAPIC
 
-#apm0	at mainbus0			# Advanced power management
+apm0	at mainbus0			# Advanced power management
 
 # Tuning for power management, see apm(4) for more details.
 #options 	APM_NO_IDLE		# Don't call BIOS CPU idle function
@@ -269,60 +269,60 @@
 				# (acpi at mainbus must also be enabled)
 #options 	MPACPI_SCANPCI	# find PCI roots using MPACPI
 
-#acpi0 		at mainbus0
-#options 	ACPI_PCI_FIXUP		# PCI interrupt routing via ACPI
+acpi0 		at mainbus0
+options 	ACPI_PCI_FIXUP		# PCI interrupt routing via ACPI
 #options 	ACPI_ACTIVATE_DEV=0	# If set, activate inactive devices
 
 # ACPI devices
-#acpiacad* 	at acpi?		# ACPI AC Adapter
-#acpibat* 	at acpi?		# ACPI Battery
-#acpibut* 	at acpi?		# ACPI Button
-#acpiec* 	at acpi?		# ACPI Embedded Controller
-#acpilid* 	at acpi?		# ACPI Lid Switch
-#acpitz* 	at acpi?		# ACPI Thermal Zone
+acpiacad* 	at acpi?		# ACPI AC Adapter
+acpibat* 	at acpi?		# ACPI Battery
+acpibut* 	at acpi?		# ACPI Button
+acpiec* 	at acpi?		# ACPI Embedded Controller
+acpilid* 	at acpi?		# ACPI Lid Switch
+acpitz* 	at acpi?		# ACPI Thermal Zone
 
 # Mainboard devices
-#com* 		at acpi?		# Serial communications interface
-#fdc* 		at acpi?		# Floppy disk controller
-#lpt* 		at acpi?		# Parallel port
-#npx*		at acpi?		# Math coprocessor
-#pckbc*  	at acpi?		# PC keyboard controller
-#wss* 		at acpi?		# NeoMagic 256AV in wss mode
+com* 		at acpi?		# Serial communications interface
+fdc* 		at acpi?		# Floppy disk controller
+lpt* 		at acpi?		# Parallel port
+npx*		at acpi?		# Math coprocessor
+pckbc*  	at acpi?		# PC keyboard controller
+wss* 		at acpi?		# NeoMagic 256AV in wss mode
 
 # Sony Vaio jog dial
-#spic* 		at acpi?		# Sony Programmable I/O Controller
-#wsmouse* 	at spic?
+spic* 		at acpi?		# Sony Programmable I/O Controller
+wsmouse* 	at spic?
 
 # Toshiba Libretto devices
-#vald* at acpi?
+vald* at acpi?
 
 # Plug-and-Play BIOS and attached devices
 
-#pnpbios*	at mainbus?
+pnpbios*	at mainbus?
 
 # mainboard audio chips
-#ess*		at pnpbios? index ?	# ESS AudioDrive
-#sb*		at pnpbios? index ?	# NeoMagic 256AV in sb mode
-#wss*		at pnpbios? index ?	# NeoMagic 256AV in wss mode
-#ym*		at pnpbios? index ?	# OPL3-SA3
+ess*		at pnpbios? index ?	# ESS AudioDrive
+sb*		at pnpbios? index ?	# NeoMagic 256AV in sb mode
+wss*		at pnpbios? index ?	# NeoMagic 256AV in wss mode
+ym*		at pnpbios? index ?	# OPL3-SA3
 
 # com port
 # If enabled, consider changing "com0", "com1", and "com2" under "ISA Serial
 # Interfaces" to "com*", otherwise com2 will attach at pnpbios? and there
 # will be no com0.  A side effect is pcmcia (and other) com? previously
 # starting at com3 may attach as com1 or com2.
-#com*		at pnpbios? index ?	# serial ports
+com*		at pnpbios? index ?	# serial ports
 
 # parallel port
 # The above "com*" comments apply, cf. "lpt0" under "ISA parallel
 # "printer interfaces".
-#lpt*		at pnpbios? index ?	# parallel ports
+lpt*		at pnpbios? index ?	# parallel ports
 
-#pckbc*		at pnpbios? index ?	# PC keyboard/mouse controller
-#fdc*		at pnpbios? index ?	# floppy controller
+pckbc*		at pnpbios? index ?	# PC keyboard/mouse controller
+fdc*		at pnpbios? index ?	# floppy controller
 
 # IDE controller on Toshiba Portege 3000 series (crippled PCI device)
-#pciide*	at pnpbios? index ?
+pciide*	at pnpbios? index ?
 
 # PCI bus support
 pci*	at mainbus? bus ?
@@ -421,10 +421,10 @@
 vga0		at isa?
 vga*		at pci? dev ? function ?
 pcdisplay0	at isa?			# CGA, MDA, EGA, HGA
-#machfb* 	at pci? dev ? function ? # ATI Mach64 framebuffer driver
+machfb* 	at pci? dev ? function ? # ATI Mach64 framebuffer driver
 wsdisplay*	at vga? console ?
 wsdisplay*	at pcdisplay? console ?
-#wsdisplay* 	at machfb? console ?
+wsdisplay* 	at machfb? console ?
 wskbd*		at pckbd? console ?
 wsmouse*	at pms? mux 0
 
@@ -448,29 +448,29 @@
 com*	at pcmcom? slave ?		# ...and the slave devices
 
 # CardBus serial interfaces
-#com*	at cardbus? dev ? function ?	# Modems and serial cards
+com*	at cardbus? dev ? function ?	# Modems and serial cards
 
 # ISA serial interfaces
 #options 	COM_HAYESP		# adds Hayes ESP serial board support
 com0	at isa? port 0x3f8 irq 4	# Standard PC serial ports
 com1	at isa? port 0x2f8 irq 3
 com2	at isa? port 0x3e8 irq 5
-#com3	at isa? port 0x2e8 irq 9
-#ast0	at isa? port 0x1a0 irq 5	# AST 4-port serial cards
-#com*	at ast? slave ?
-#boca0	at isa? port 0x100 irq 5	# BOCA 8-port serial cards
-#boca0	at isa? port 0x100 irq 5	# BOCA 16-port serial cards (BB2016)
-#boca1	at isa? port 0x140 irq 5	# this line is also needed for BB2016
-#com*	at boca? slave ?
-#tcom0	at isa? port 0x100 irq 7	# TC-800 8-port serial cards
-#com*	at tcom? slave ?
-#rtfps0	at isa? port 0x1230 irq 10	# RT 4-port serial cards
-#com*	at rtfps? slave ?
-#cy0	at isa? iomem 0xd4000 irq 12	# Cyclades serial cards
-#addcom0 at isa? port 0x108 irq 5	# Addonics FlexPort 8S
-#com*	at addcom? slave ?
-#moxa0	at isa?	port 0x100 irq 5	# MOXA C168H serial card (experimental)
-#com*	at moxa? slave ?
+com3	at isa? port 0x2e8 irq 9
+ast0	at isa? port 0x1a0 irq 5	# AST 4-port serial cards
+com*	at ast? slave ?
+boca0	at isa? port 0x100 irq 5	# BOCA 8-port serial cards
+boca0	at isa? port 0x100 irq 5	# BOCA 16-port serial cards (BB2016)
+boca1	at isa? port 0x140 irq 5	# this line is also needed for BB2016
+com*	at boca? slave ?
+tcom0	at isa? port 0x100 irq 7	# TC-800 8-port serial cards
+com*	at tcom? slave ?
+rtfps0	at isa? port 0x1230 irq 10	# RT 4-port serial cards
+com*	at rtfps? slave ?
+cy0	at isa? iomem 0xd4000 irq 12	# Cyclades serial cards
+addcom0 at isa? port 0x108 irq 5	# Addonics FlexPort 8S
+com*	at addcom? slave ?
+moxa0	at isa?	port 0x100 irq 5	# MOXA C168H serial card (experimental)
+com*	at moxa? slave ?
 
 # MCA serial interfaces
 com*	at mca? slot ?			# 16x50s on comm boards
@@ -491,8 +491,8 @@
 #lm0	at isa?	port 0x290		# other common ports: 0x280, 0x310
 
 # VIA VT82C686A hardware monitor
-#viapm*	at pci? dev ? function ?
-#viaenv* at viapm?
+viapm*	at pci? dev ? function ?
+viaenv* at viapm?
 
 
 # I2O devices
@@ -544,9 +544,9 @@
 bha0	at isa? port 0x330 irq ? drq ?	# BusLogic [457]4X SCSI
 bha1	at isa? port 0x334 irq ? drq ?
 # The "nca" and "dpt" probes might give false hits or hang your machine.
-#dpt0	at isa? port 0x170 irq ? drq ?	# DPT SmartCache/SmartRAID
-#nca0	at isa? port 0x360 irq 15	# Port-mapped NCR 53C80 controller
-#nca1	at isa? iomem 0xd8000 irq 5	# Memory-mapped controller (T128, etc.)
+dpt0	at isa? port 0x170 irq ? drq ?	# DPT SmartCache/SmartRAID
+nca0	at isa? port 0x360 irq 15	# Port-mapped NCR 53C80 controller
+nca1	at isa? iomem 0xd8000 irq 5	# Memory-mapped controller (T128, etc.)
 sea0	at isa? iomem 0xc8000 irq 5	# Seagate/Future Domain SCSI
 uha0	at isa? port 0x330 irq ? drq ?	# UltraStor [13]4f SCSI
 uha1	at isa? port 0x340 irq ? drq ?
@@ -554,8 +554,8 @@
 wds1	at isa? port 0x358 irq 11 drq 5
 
 # CardBus SCSI cards
-#adv*	at cardbus? dev ? function ?	# AdvanSys 1200[A,B], 9xx[U,UA] SCSI
-#ahc*	at cardbus? dev ? function ?	# Adaptec ADP-1480
+adv*	at cardbus? dev ? function ?	# AdvanSys 1200[A,B], 9xx[U,UA] SCSI
+ahc*	at cardbus? dev ? function ?	# Adaptec ADP-1480
 
 # MCA SCSI cards
 aha*	at mca? slot ?			# Adaptec AHA-1640
@@ -645,13 +645,13 @@
 
 # ISA floppy
 fdc0	at isa? port 0x3f0 irq 6 drq 2	# standard PC floppy controllers
-#fdc1	at isa? port 0x370 irq ? drq ?
+fdc1	at isa? port 0x370 irq ? drq ?
 fd*	at fdc? drive ?			# the drives themselves
 # some machines need you to do this instead of fd*
-#fd0	at fdc0 drive 0
+fd0	at fdc0 drive 0
 
 # ISA CD-ROM devices
-#mcd0	at isa? port 0x300 irq 10	# Mitsumi CD-ROM drives
+mcd0	at isa? port 0x300 irq 10	# Mitsumi CD-ROM drives
 
 # ISA tape devices
 # note: the wt driver conflicts unpleasantly with SMC boards at the
@@ -677,7 +677,7 @@
 fpa*	at pci? dev ? function ?	# DEC DEFPA FDDI
 fxp*	at pci? dev ? function ?	# Intel EtherExpress PRO 10+/100B
 gsip*	at pci? dev ? function ?	# NS83820 Gigabit Ethernet
-#hme*	at pci? dev ? function ?	# Sun Microelectronics STP2002-STQ
+hme*	at pci? dev ? function ?	# Sun Microelectronics STP2002-STQ
 le*	at pci? dev ? function ?	# PCnet-PCI Ethernet
 lmc*	at pci? dev ? function ?	# Lan Media Corp SSI/HSSI/DS3
 mtd*	at pci? dev ? function ?	# Myson MTD803 3-in-1 Ethernet
@@ -719,7 +719,7 @@
 ray*	at pcmcia? function ?		# Raytheon Raylink (802.11)
 sm*	at pcmcia? function ?		# Megahertz Ethernet
 # tr at pcmcia has problems with Cardbus bridges
-#tr*	at pcmcia? function ?		# TROPIC based Token-Ring
+tr*	at pcmcia? function ?		# TROPIC based Token-Ring
 wi*	at pcmcia? function ?		# Lucent/Intersil WaveLan IEEE (802.11)
 xi*	at pcmcia? function ?		# Xircom CreditCard Ethernet
 
@@ -740,11 +740,11 @@
 ix0	at isa? port 0x300 irq 10		# EtherExpress/16
 iy0	at isa? port 0x360 irq ?		# EtherExpress PRO 10 ISA
 lc0	at isa? port 0x320 iomem ? irq ?	# DEC EtherWORKS III (LEMAC)
-#depca0	at isa? port 0x300 iomem 0xc8000 iosiz 0x8000 irq 5	# DEPCA
-#le*	at depca?
+depca0	at isa? port 0x300 iomem 0xc8000 iosiz 0x8000 irq 5	# DEPCA
+le*	at depca?
 nele0	at isa? port 0x320 irq 9 drq 7		# NE2100
 le*	at nele?
-#ntwoc0	at isa? port 0x300 irq 5 iomem 0xc8000 flags 1	# Riscom/N2 sync serial
+ntwoc0	at isa? port 0x300 irq 5 iomem 0xc8000 flags 1	# Riscom/N2 sync serial
 bicc0	at isa? port 0x320 irq 10 drq 7		# BICC IsoLan
 le*	at bicc?
 ne0	at isa? port 0x280 irq 9		# NE[12]000 ethernet cards
@@ -757,10 +757,10 @@
 we1	at isa? port 0x300 iomem 0xcc000 irq 10
 
 # CardBus network cards
-#ex*	at cardbus? dev ? function ?	# 3Com 3C575TX
-#fxp*	at cardbus? dev ? function ?	# Intel i8255x
-#rtk*	at cardbus? dev ? function ?	# Realtek 8129/8139
-#tlp*	at cardbus? dev ? function ?	# DECchip 21143
+ex*	at cardbus? dev ? function ?	# 3Com 3C575TX
+fxp*	at cardbus? dev ? function ?	# Intel i8255x
+rtk*	at cardbus? dev ? function ?	# Realtek 8129/8139
+tlp*	at cardbus? dev ? function ?	# DECchip 21143
 
 # MCA network cards
 elmc*	at mca? slot ?			# 3Com EtherLink/MC (3c523)
@@ -801,22 +801,22 @@
 
 # PCI USB controllers
 # The EHCI is not ready for prime time.
-#ehci*	at pci?	dev ? function ?	# Enhanced Host Controller
+ehci*	at pci?	dev ? function ?	# Enhanced Host Controller
 ohci*	at pci?	dev ? function ?	# Open Host Controller
 uhci*	at pci?	dev ? function ?	# Universal Host Controller (Intel)
 
 # CardBus USB controllers
-#ehci*	at cardbus? dev ? function ?	# Enhanced Host Controller
-#ohci*	at cardbus? dev ? function ?	# Open Host Controller
+ehci*	at cardbus? dev ? function ?	# Enhanced Host Controller
+ohci*	at cardbus? dev ? function ?	# Open Host Controller
 
 # ISA USB controllers
-#slhci0	at isa? port 0x300 irq 5	# ScanLogic SL811HS
+slhci0	at isa? port 0x300 irq 5	# ScanLogic SL811HS
 
 # USB bus support
-#usb*	at ehci?
+usb*	at ehci?
 usb*	at ohci?
 usb*	at uhci?
-#usb*	at slhci?
+usb*	at slhci?
 
 # USB Hubs
 uhub*	at usb?
@@ -919,17 +919,17 @@
 irframe* at oboe?
 
 # PCI IEEE1394 controllers
-#fwohci* at pci? dev ? function ?	# IEEE1394 Open Host Controller
+fwohci* at pci? dev ? function ?	# IEEE1394 Open Host Controller
 
 # CardBus IEEE1394 controllers
-#fwohci* at cardbus? dev ? function ?	# IEEE1394 Open Host Controller
+fwohci* at cardbus? dev ? function ?	# IEEE1394 Open Host Controller
 
-#fw*	at fwbus?			# IP over 1394
+fw*	at fwbus?			# IP over 1394
 
 # IEEE1394 nodes
-#fwnode* at fwbus? idhi ? idlo ?
-#sbpscsi* at fwnode?
-#scsibus* at sbpscsi?
+fwnode* at fwbus? idhi ? idlo ?
+sbpscsi* at fwnode?
+scsibus* at sbpscsi?
 
 # Audio Devices
 
@@ -959,24 +959,24 @@
 
 # ISA audio devices
 # the "aria" probe might give false hits
-#aria0	at isa? port 0x290 irq 10 		# Aria
-#ess0	at isa? port 0x220 irq 5 drq 1 drq2 5	# ESS 18XX
+aria0	at isa? port 0x290 irq 10 		# Aria
+ess0	at isa? port 0x220 irq 5 drq 1 drq2 5	# ESS 18XX
 gus0	at isa? port 0x220 irq 7 drq 1 drq2 6	# Gravis Ultra Sound
 pas0	at isa? port 0x220 irq 7 drq 1		# ProAudio Spectrum
-#pss0	at isa? port 0x220 irq 7 drq 6		# Personal Sound System
-#sp0	at pss0 port 0x530 irq 10 drq 0		# 	sound port driver
+pss0	at isa? port 0x220 irq 7 drq 6		# Personal Sound System
+sp0	at pss0 port 0x530 irq 10 drq 0		# 	sound port driver
 sb0	at isa? port 0x220 irq 5 drq 1 drq2 5	# SoundBlaster
 wss0	at isa? port 0x530 irq 10 drq 0	drq2 1	# Windows Sound System
 
 # PCMCIA audio devices
-#esl*	at pcmcia? function ?			# ESS 1688 AudioDrive
+esl*	at pcmcia? function ?			# ESS 1688 AudioDrive
 
 #cms0	at isa? port 0x220			# Creative Music System
 
 # OPL[23] FM synthesizers
 #opl0	at isa? port 0x388	# use only if not attached to sound card
 opl*	at cmpci? flags 1
-#opl*	at esl?
+opl*	at esl?
 opl*	at eso?
 opl*	at ess?
 opl*	at fms?
@@ -1003,30 +1003,30 @@
 midi*	at pcppi?		# MIDI interface to the PC speaker
 
 # The spkr driver provides a simple tone interface to the built in speaker.
-#spkr0	at pcppi?		# PC speaker
+spkr0	at pcppi?		# PC speaker
 
 
 # FM-Radio devices
 # ISA radio devices
-#az0	at isa? port 0x350      # Aztech/PackardBell FM Radio Card
-#az1	at isa? port 0x358
-#rt0	at isa? port 0x20c      # AIMS Lab Radiotrack & compatible
-#rt1	at isa? port 0x284
-#rt2	at isa? port 0x30c
-#rt3	at isa? port 0x384
-#rtii0	at isa? port 0x20c      # AIMS Lab Radiotrack II FM Radio Card
-#rtii1	at isa? port 0x30c
-#sf2r0	at isa? port 0x384      # SoundForte RadioLink SF16-FMR2 FM Radio Card
+az0	at isa? port 0x350      # Aztech/PackardBell FM Radio Card
+az1	at isa? port 0x358
+rt0	at isa? port 0x20c      # AIMS Lab Radiotrack & compatible
+rt1	at isa? port 0x284
+rt2	at isa? port 0x30c
+rt3	at isa? port 0x384
+rtii0	at isa? port 0x20c      # AIMS Lab Radiotrack II FM Radio Card
+rtii1	at isa? port 0x30c
+sf2r0	at isa? port 0x384      # SoundForte RadioLink SF16-FMR2 FM Radio Card
 
 # PCI radio devices
-#gtp*	at pci? dev ? function ? # Guillemot Maxi Radio FM 2000 Radio Card
+gtp*	at pci? dev ? function ? # Guillemot Maxi Radio FM 2000 Radio Card
 
 # Radio support
-#radio*	at az?
-#radio*	at gtp?
-#radio*	at rt?
-#radio*	at rtii?
-#radio*	at sf2r?
+radio*	at az?
+radio*	at gtp?
+radio*	at rt?
+radio*	at rtii?
+radio*	at sf2r?
 
 
 # TV cards
@@ -1079,7 +1079,7 @@
 
 # disk/mass storage pseudo-devices
 pseudo-device	ccd		4	# concatenated/striped disk devices
-#pseudo-device	cgd		4	# cryptographic disk devices
+pseudo-device	cgd		4	# cryptographic disk devices
 pseudo-device	raid		8	# RAIDframe disk driver
 options 	RAID_AUTOCONFIG		# auto-configuration of RAID components
 # Options to enable various other RAIDframe RAID types.
@@ -1106,8 +1106,8 @@
 pseudo-device	tun		2	# network tunneling over tty
 pseudo-device	gre		2	# generic L3 over IP tunnel
 pseudo-device	gif		4	# IPv[46] over IPv[46] tunnel (RFC1933)
-#pseudo-device	faith		1	# IPv[46] tcp relay translation i/f
-#pseudo-device	stf		1	# 6to4 IPv6 over IPv4 encapsulation
+pseudo-device	faith		1	# IPv[46] tcp relay translation i/f
+pseudo-device	stf		1	# 6to4 IPv6 over IPv4 encapsulation
 pseudo-device	vlan			# IEEE 802.1q encapsulation
 pseudo-device	bridge			# simple inter-network bridging
 #options	BRIDGE_IPF		# bridge uses IP/IPv6 pfil hooks too
--- a/sys/arch/i386/i386/apm.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/i386/i386/apm.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: apm.c,v 1.77 2003/04/26 22:07:15 wiz Exp $ */
+/*	$NetBSD: apm.c,v 1.78 2003/06/28 14:20:54 darrenr Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.77 2003/04/26 22:07:15 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.78 2003/06/28 14:20:54 darrenr Exp $");
 
 #include "apm.h"
 #if NAPM > 1
@@ -1592,10 +1592,10 @@
 }
 
 int
-apmopen(dev, flag, mode, p)
+apmopen(dev, flag, mode, l)
 	dev_t dev;
 	int flag, mode;
-	struct proc *p;
+	struct lwp *l;
 {
 	int unit = APMUNIT(dev);
 	int ctl = APMDEV(dev);
@@ -1612,7 +1612,7 @@
 		return ENXIO;
 	
 	DPRINTF(APMDEBUG_DEVICE,
-	    ("apmopen: pid %d flag %x mode %x\n", p->p_pid, flag, mode));
+	    ("apmopen: pid %d flag %x mode %x\n", l->l_proc->p_pid, flag, mode));
 
 	APM_LOCK(sc);
 	switch (ctl) {
@@ -1644,16 +1644,16 @@
 }
 
 int
-apmclose(dev, flag, mode, p)
+apmclose(dev, flag, mode, l)
 	dev_t dev;
 	int flag, mode;
-	struct proc *p;
+	struct lwp *l;
 {
 	struct apm_softc *sc = apm_cd.cd_devs[APMUNIT(dev)];
 	int ctl = APMDEV(dev);
 
 	DPRINTF(APMDEBUG_DEVICE,
-	    ("apmclose: pid %d flag %x mode %x\n", p->p_pid, flag, mode));
+	    ("apmclose: pid %d flag %x mode %x\n", l->l_proc->p_pid, flag, mode));
 
 	APM_LOCK(sc);
 	switch (ctl) {
@@ -1673,12 +1673,12 @@
 }
 
 int
-apmioctl(dev, cmd, data, flag, p)
+apmioctl(dev, cmd, data, flag, l)
 	dev_t dev;
 	u_long cmd;
 	caddr_t data;
 	int flag;
-	struct proc *p;
+	struct lwp *l;
 {
 	struct apm_softc *sc = apm_cd.cd_devs[APMUNIT(dev)];
 	struct apm_power_info *powerp;
@@ -1798,10 +1798,10 @@
 }
 
 int
-apmpoll(dev, events, p)
+apmpoll(dev, events, l)
 	dev_t dev;
 	int events;
-	struct proc *p;
+	struct lwp *l;
 {
 	struct apm_softc *sc = apm_cd.cd_devs[APMUNIT(dev)];
 	int revents = 0;
@@ -1811,7 +1811,7 @@
 		if (sc->event_count)
 			revents |= events & (POLLIN | POLLRDNORM);
 		else
-			selrecord(p, &sc->sc_rsel);
+			selrecord(l, &sc->sc_rsel);
 	}
 	APM_UNLOCK(sc);
 
--- a/sys/arch/i386/i386/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/i386/i386/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.524 2003/06/26 16:47:15 drochner Exp $	*/
+/*	$NetBSD: machdep.c,v 1.525 2003/06/28 14:20:55 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.524 2003/06/26 16:47:15 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.525 2003/06/28 14:20:55 darrenr Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -497,14 +497,14 @@
  * machine dependent system variables.
  */
 int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
+cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, l)
 	int *name;
 	u_int namelen;
 	void *oldp;
 	size_t *oldlenp;
 	void *newp;
 	size_t newlen;
-	struct proc *p;
+	struct lwp *l;
 {
 	dev_t consdev;
 	struct btinfo_bootpath *bibp;
@@ -2149,14 +2149,14 @@
  * if COMPAT_NOMID is given as a kernel option.
  */
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	int error = ENOEXEC;
 
 #ifdef COMPAT_NOMID
-	if ((error = exec_nomid(p, epp)) == 0)
+	if ((error = exec_nomid(l->l_proc, epp)) == 0)
 		return error;
 #endif /* ! COMPAT_NOMID */
 
--- a/sys/arch/i386/i386/mem.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/i386/i386/mem.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem.c,v 1.56 2003/02/26 21:28:23 fvdl Exp $	*/
+/*	$NetBSD: mem.c,v 1.57 2003/06/28 14:20:55 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.56 2003/02/26 21:28:23 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.57 2003/06/28 14:20:55 darrenr Exp $");
 
 #include "opt_compat_netbsd.h"
 
@@ -80,10 +80,10 @@
 
 /*ARGSUSED*/
 int
-mmopen(dev, flag, mode, p)
+mmopen(dev, flag, mode, l)
 	dev_t dev;
 	int flag, mode;
-	struct proc *p;
+	struct lwp *l;
 {
 
 	switch (minor(dev)) {
--- a/sys/arch/i386/i386/process_machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/i386/i386/process_machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: process_machdep.c,v 1.46 2003/01/17 23:10:31 thorpej Exp $	*/
+/*	$NetBSD: process_machdep.c,v 1.47 2003/06/28 14:20:56 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.46 2003/01/17 23:10:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.47 2003/06/28 14:20:56 darrenr Exp $");
 
 #include "opt_vm86.h"
 #include "npx.h"
@@ -456,8 +456,8 @@
 }
 
 int
-ptrace_machdep_dorequest(p, lt, req, addr, data)
-	struct proc *p;
+ptrace_machdep_dorequest(l, lt, req, addr, data)
+	struct lwp *l;
 	struct lwp *lt;
 	int req;
 	caddr_t addr;
@@ -484,8 +484,8 @@
 			uio.uio_resid = sizeof(struct xmmregs);
 			uio.uio_segflg = UIO_USERSPACE;
 			uio.uio_rw = write ? UIO_WRITE : UIO_READ;
-			uio.uio_procp = p;
-			return (process_machdep_doxmmregs(p, lt, &uio));
+			uio.uio_lwp = l;
+			return (process_machdep_doxmmregs(l, lt, &uio));
 		}
 	}
 
@@ -501,8 +501,8 @@
  */
 
 int
-process_machdep_doxmmregs(curp, l, uio)
-	struct proc *curp;		/* tracer */
+process_machdep_doxmmregs(curl, l, uio)
+	struct lwp *curl;		/* tracer */
 	struct lwp *l;			/* traced */
 	struct uio *uio;
 {
@@ -511,7 +511,7 @@
 	char *kv;
 	int kl;
 
-	if ((error = process_checkioperm(curp, l->l_proc)) != 0)
+	if ((error = process_checkioperm(curl, l->l_proc)) != 0)
 		return (error);
 
 	kl = sizeof(r);
--- a/sys/arch/i386/i386/procfs_machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/i386/i386/procfs_machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.13 2003/06/26 16:37:20 drochner Exp $	*/
+/*	$NetBSD: procfs_machdep.c,v 1.14 2003/06/28 14:20:56 darrenr Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.13 2003/06/26 16:37:20 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.14 2003/06/28 14:20:56 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -179,13 +179,13 @@
 }
 
 int
-procfs_machdep_rw(struct proc *curp, struct lwp *l, struct pfsnode *pfs,
+procfs_machdep_rw(struct lwp *curl, struct lwp *l, struct pfsnode *pfs,
     struct uio *uio)
 {
 
 	switch (pfs->pfs_type) {
 	case Pmachdep_xmmregs:
-		return (procfs_machdep_doxmmregs(curp, l, pfs, uio));
+		return (procfs_machdep_doxmmregs(curl, l, pfs, uio));
 
 	default:
 		panic("procfs_machdep_rw");
@@ -213,17 +213,17 @@
 }
 
 int
-procfs_machdep_doxmmregs(struct proc *curp, struct lwp *l,
+procfs_machdep_doxmmregs(struct lwp *curl, struct lwp *l,
     struct pfsnode *pfs, struct uio *uio)
 {
 
-	return (process_machdep_doxmmregs(curp, l, uio));
+	return (process_machdep_doxmmregs(curl, l, uio));
 }
 
 int
-procfs_machdep_validxmmregs(struct proc *p, struct mount *mp)
+procfs_machdep_validxmmregs(struct lwp *l, struct mount *mp)
 {
 
-	return (process_machdep_validxmmregs(p));
+	return (process_machdep_validxmmregs(l->l_proc));
 }
 #endif
--- a/sys/arch/i386/i386/syscall.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/i386/i386/syscall.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: syscall.c,v 1.18 2003/01/17 23:10:32 thorpej Exp $	*/
+/*	$NetBSD: syscall.c,v 1.19 2003/06/28 14:20:56 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.18 2003/01/17 23:10:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.19 2003/06/28 14:20:56 darrenr Exp $");
 
 #include "opt_syscall_debug.h"
 #include "opt_vm86.h"
@@ -310,7 +310,7 @@
 #ifdef KTRACE
 	if (KTRPOINT(p, KTR_SYSRET)) {
 		KERNEL_PROC_LOCK(l);
-		ktrsysret(p, SYS_fork, 0, 0);
+		ktrsysret(l, SYS_fork, 0, 0);
 		KERNEL_PROC_UNLOCK(l);
 	}
 #endif
--- a/sys/arch/i386/i386/vm_machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/i386/i386/vm_machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.108 2003/01/20 01:28:33 simonb Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.109 2003/06/28 14:20:56 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1995 Charles M. Hannum.  All rights reserved.
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.108 2003/01/20 01:28:33 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.109 2003/06/28 14:20:56 darrenr Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_largepages.h"
@@ -285,7 +285,6 @@
 	struct ucred *cred;
 	struct core *chdr;
 {
-	struct proc *p = l->l_proc;
 	struct md_core md_core;
 	struct coreseg cseg;
 	int error;
@@ -311,13 +310,13 @@
 
 	error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
 	    (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred,
-	    NULL, p);
+	    NULL, l);
 	if (error)
 		return error;
 
 	error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&md_core, sizeof(md_core),
 	    (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE,
-	    IO_NODELOCKED|IO_UNIT, cred, NULL, p);
+	    IO_NODELOCKED|IO_UNIT, cred, NULL, l);
 	if (error)
 		return error;
 
@@ -404,6 +403,7 @@
 	vsize_t len;
 {
 	vaddr_t faddr, taddr, off;
+	struct proc *p;
 	paddr_t fpa;
 
 	if ((bp->b_flags & B_PHYS) == 0)
@@ -425,8 +425,9 @@
 	 * where we we just allocated (TLB will be flushed when our
 	 * mapping is removed).
 	 */
+	p = bp->b_proc;
 	while (len) {
-		(void) pmap_extract(vm_map_pmap(&bp->b_proc->p_vmspace->vm_map),
+		(void) pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map),
 		    faddr, &fpa);
 		pmap_kenter_pa(taddr, fpa, VM_PROT_READ|VM_PROT_WRITE);
 		faddr += PAGE_SIZE;
--- a/sys/arch/i386/include/ptrace.h	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/i386/include/ptrace.h	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.9 2003/01/17 23:10:29 thorpej Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.10 2003/06/28 14:20:57 darrenr Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -125,15 +125,15 @@
 struct xmmregs;
 
 /* Functions used by both ptrace(2) and procfs. */
-int	process_machdep_doxmmregs(struct proc *, struct lwp *, struct uio *);
+int	process_machdep_doxmmregs(struct lwp *, struct lwp *, struct uio *);
 int	process_machdep_validxmmregs(struct proc *);
 
 /* Functions used by procfs. */
 struct mount;
 struct pfsnode;
-int	procfs_machdep_doxmmregs(struct proc *, struct lwp *,
+int	procfs_machdep_doxmmregs(struct lwp *, struct lwp *,
 	    struct pfsnode *, struct uio *);
-int	procfs_machdep_validxmmregs(struct proc *, struct mount *);
+int	procfs_machdep_validxmmregs(struct lwp *, struct mount *);
 
 #endif /* _KERNEL */
 
--- a/sys/arch/luna68k/luna68k/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/luna68k/luna68k/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.31 2003/06/23 11:01:25 martin Exp $ */
+/* $NetBSD: machdep.c,v 1.32 2003/06/28 14:20:57 darrenr Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.31 2003/06/23 11:01:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.32 2003/06/28 14:20:57 darrenr Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -888,15 +888,15 @@
  * understand and, if so, set up the vmcmds for it.
  */
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	int error = ENOEXEC;
 #ifdef COMPAT_SUNOS
 	extern sunos_exec_aout_makecmds
 	__P((struct proc *, struct exec_package *));
-	if ((error = sunos_exec_aout_makecmds(p, epp)) == 0)
+	if ((error = sunos_exec_aout_makecmds(l->l_proc, epp)) == 0)
 		return 0;
 #endif
 	return error;
--- a/sys/arch/m68k/m68k/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/m68k/m68k/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.6 2003/04/02 00:00:46 thorpej Exp $ */
+/* $NetBSD: bus_dma.c,v 1.7 2003/06/28 14:20:57 darrenr Exp $ */
 
 /*
  * This file was taken from from alpha/common/bus_dma.c
@@ -46,7 +46,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.6 2003/04/02 00:00:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.7 2003/06/28 14:20:57 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -342,7 +342,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_direct_common: USERSPACE but no proc");
--- a/sys/arch/m68k/m68k/m68k_syscall.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/m68k/m68k/m68k_syscall.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: m68k_syscall.c,v 1.7 2003/01/17 23:18:29 thorpej Exp $	*/
+/*	$NetBSD: m68k_syscall.c,v 1.8 2003/06/28 14:20:58 darrenr Exp $	*/
 
 /*-
  * Portions Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -441,7 +441,7 @@
 	machine_userret(l, f, 0);
 #ifdef KTRACE
 	if (KTRPOINT(l->l_proc, KTR_SYSRET))
-		ktrsysret(l->l_proc, SYS_fork, 0, 0);
+		ktrsysret(l, SYS_fork, 0, 0);
 #endif
 }
 
--- a/sys/arch/mac68k/mac68k/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/mac68k/mac68k/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.288 2003/05/10 21:10:32 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.289 2003/06/28 14:20:58 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1062,8 +1062,8 @@
 }
 
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	int error = ENOEXEC;
@@ -1071,7 +1071,7 @@
 #ifdef COMPAT_NOMID
 	/* Check to see if MID == 0. */
 	if (((struct exec *)epp->ep_hdr)->a_midmag == ZMAGIC)
-		return exec_aout_prep_oldzmagic(p, epp);
+		return exec_aout_prep_oldzmagic(l->l_proc, epp);
 #endif
 
 	return error;
--- a/sys/arch/macppc/macppc/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/macppc/macppc/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.25 2003/04/02 03:04:03 thorpej Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.26 2003/06/28 14:20:59 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -324,7 +324,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/mips/mips/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/mips/mips/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.6 2003/05/14 10:09:49 simonb Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.7 2003/06/28 14:20:59 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.6 2003/05/14 10:09:49 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.7 2003/06/28 14:20:59 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -332,7 +332,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/mips/mips/cpu_exec.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/mips/mips/cpu_exec.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_exec.c,v 1.36 2003/04/02 03:27:35 thorpej Exp $	*/
+/*	$NetBSD: cpu_exec.c,v 1.37 2003/06/28 14:21:00 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -62,7 +62,7 @@
 #include <machine/reg.h>
 #include <mips/regnum.h>			/* symbolic register indices */
 
-int	mips_elf_makecmds(struct proc *, struct exec_package *);
+int	mips_elf_makecmds(struct lwp *, struct exec_package *);
 
 
 /*
@@ -74,8 +74,8 @@
  *
  */
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	int error;
@@ -90,7 +90,7 @@
 #endif
 	{
 		/* If that failed, try old NetBSD-1.1 elf format */
-		error = mips_elf_makecmds (p, epp);
+		error = mips_elf_makecmds (l, epp);
 		return error;
 	}
 
@@ -154,15 +154,15 @@
 #endif /* EXEC_ECOFF */
 
 /*
- * mips_elf_makecmds (p, epp)
+ * mips_elf_makecmds (l, epp)
  *
  * Test if an executable is a MIPS ELF executable.   If it is,
  * try to load it.
  */
 
 int
-mips_elf_makecmds (p, epp)
-        struct proc *p;
+mips_elf_makecmds (l, epp)
+        struct lwp *l;
         struct exec_package *epp;
 {
 	Elf32_Ehdr *ex = (Elf32_Ehdr *)epp->ep_hdr;
--- a/sys/arch/mips/mips/trap.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/mips/mips/trap.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.177 2003/06/02 05:55:11 simonb Exp $	*/
+/*	$NetBSD: trap.c,v 1.178 2003/06/28 14:21:00 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.177 2003/06/02 05:55:11 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.178 2003/06/28 14:21:00 darrenr Exp $");
 
 #include "opt_cputype.h"	/* which mips CPU levels do we support? */
 #include "opt_ktrace.h"
@@ -154,7 +154,7 @@
 	userret(l);
 #ifdef KTRACE
 	if (KTRPOINT(l->l_proc, KTR_SYSRET))
-		ktrsysret(l->l_proc, SYS_fork, 0, 0);
+		ktrsysret(l, SYS_fork, 0, 0);
 #endif
 }
 
--- a/sys/arch/mipsco/mipsco/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/mipsco/mipsco/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.10 2003/04/02 04:00:45 thorpej Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.11 2003/06/28 14:21:01 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -356,7 +356,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/mvme68k/mvme68k/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/mvme68k/mvme68k/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.21 2003/04/02 02:19:29 thorpej Exp $	*/
+/* $NetBSD: bus_dma.c,v 1.22 2003/06/28 14:21:01 darrenr Exp $	*/
 
 /*
  * This file was taken from from next68k/dev/bus_dma.c, which was originally
@@ -46,7 +46,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.21 2003/04/02 02:19:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.22 2003/06/28 14:21:01 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -357,7 +357,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_direct_common: USERSPACE but no proc");
--- a/sys/arch/mvme68k/mvme68k/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/mvme68k/mvme68k/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.101 2003/06/23 11:01:30 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.102 2003/06/28 14:21:01 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -160,7 +160,7 @@
 int	cpu_dump __P((int (*)(dev_t, daddr_t, caddr_t, size_t), daddr_t *));
 void	cpu_init_kcore_hdr __P((void));
 u_long	cpu_dump_mempagecnt __P((void));
-int	cpu_exec_aout_makecmds __P((struct proc *, struct exec_package *));
+int	cpu_exec_aout_makecmds __P((struct lwp *, struct exec_package *));
 void	straytrap __P((int, u_short));
 
 /*
@@ -1237,8 +1237,8 @@
  * understand and, if so, set up the vmcmds for it.
  */
 int
-cpu_exec_aout_makecmds(p, epp)
-    struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+    struct lwp *l;
     struct exec_package *epp;
 {
     return ENOEXEC;
--- a/sys/arch/news68k/news68k/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/news68k/news68k/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.40 2003/05/10 21:10:34 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.41 2003/06/28 14:21:02 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -840,8 +840,8 @@
  *	done on little-endian machines...  -- cgd
  */
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 #if defined(COMPAT_NOMID) || defined(COMPAT_44)
@@ -859,7 +859,7 @@
 	switch (midmag) {
 #ifdef COMPAT_NOMID
 	case (MID_ZERO << 16) | ZMAGIC:
-		error = exec_aout_prep_oldzmagic(p, epp);
+		error = exec_aout_prep_oldzmagic(l->l_proc, epp);
 		return(error);
 #endif
 #ifdef COMPAT_44
--- a/sys/arch/newsmips/newsmips/bus.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/newsmips/newsmips/bus.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.12 2003/04/19 14:56:06 tsutsui Exp $	*/
+/*	$NetBSD: bus.c,v 1.13 2003/06/28 14:21:02 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -424,7 +424,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/next68k/next68k/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/next68k/next68k/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.59 2003/05/10 21:10:35 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.60 2003/06/28 14:21:02 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1021,8 +1021,8 @@
  * understand and, if so, set up the vmcmds for it.
  */
 int
-cpu_exec_aout_makecmds(p, epp)
-    struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+    struct lwp *l;
     struct exec_package *epp;
 {
     return ENOEXEC;
--- a/sys/arch/pc532/pc532/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/pc532/pc532/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.142 2003/06/24 02:48:58 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.143 2003/06/28 14:21:03 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1996 Matthias Pfaller.
@@ -1158,8 +1158,8 @@
  * Any takers for Sinix, Genix, SVR2/32000 or Minix?
  */
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	return ENOEXEC;
--- a/sys/arch/playstation2/playstation2/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/playstation2/playstation2/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.4 2003/04/02 04:18:40 thorpej Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.5 2003/06/28 14:21:04 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -318,7 +318,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/playstation2/playstation2/kloader.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/playstation2/playstation2/kloader.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: kloader.c,v 1.5 2003/05/08 13:35:06 shin Exp $	*/
+/*	$NetBSD: kloader.c,v 1.6 2003/06/28 14:21:04 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -290,7 +290,7 @@
 	struct proc *p = curlwp->l_proc;
 	struct nameidata nid;
 
-	NDINIT(&nid, LOOKUP, FOLLOW, UIO_SYSSPACE, filename, p);
+	NDINIT(&nid, LOOKUP, FOLLOW, UIO_SYSSPACE, filename, curlwp);
 
 	if (namei(&nid) != 0) {
 		DPRINTF("namei failed (%s)\n", filename);
--- a/sys/arch/pmax/pmax/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/pmax/pmax/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.35 2003/04/02 04:19:50 thorpej Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.36 2003/06/28 14:21:04 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -365,7 +365,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/powerpc/marvell/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/powerpc/marvell/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.2 2003/04/02 02:47:18 thorpej Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.3 2003/06/28 14:21:04 darrenr Exp $	*/
 
 #define DEBUG 1
 
@@ -413,7 +413,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/powerpc/powerpc/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/powerpc/powerpc/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.13 2003/06/12 08:30:41 scw Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.14 2003/06/28 14:21:05 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -377,7 +377,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/powerpc/powerpc/process_machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/powerpc/powerpc/process_machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: process_machdep.c,v 1.12 2003/03/05 05:27:24 matt Exp $	*/
+/*	$NetBSD: process_machdep.c,v 1.13 2003/06/28 14:21:05 darrenr Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -196,7 +196,7 @@
 		uio.uio_resid = sizeof(struct vreg);
 		uio.uio_segflg = UIO_USERSPACE;
 		uio.uio_rw = write ? UIO_WRITE : UIO_READ;
-		uio.uio_procp = p;
+		uio.uio_lwp = l;
 		return process_machdep_dovecregs(p, l, &uio);
 	}
 
--- a/sys/arch/powerpc/powerpc/syscall.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/powerpc/powerpc/syscall.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: syscall.c,v 1.19 2003/06/23 11:01:36 martin Exp $	*/
+/*	$NetBSD: syscall.c,v 1.20 2003/06/28 14:21:05 darrenr Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -69,7 +69,7 @@
 #define EMULNAME(x)	(x)
 #define EMULNAMEU(x)	(x)
 
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.19 2003/06/23 11:01:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.20 2003/06/28 14:21:05 darrenr Exp $");
 
 void
 child_return(void *arg)
@@ -91,7 +91,7 @@
 #ifdef	KTRACE
 	if (KTRPOINT(p, KTR_SYSRET)) {
 		KERNEL_PROC_LOCK(l);
-		ktrsysret(p, SYS_fork, 0, 0);
+		ktrsysret(l, SYS_fork, 0, 0);
 		KERNEL_PROC_UNLOCK(l);
 	}
 #endif
--- a/sys/arch/sgimips/sgimips/bus.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/sgimips/sgimips/bus.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.17 2003/04/02 04:27:19 thorpej Exp $	*/
+/*	$NetBSD: bus.c,v 1.18 2003/06/28 14:21:05 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -542,7 +542,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/sh3/sh3/coff_exec.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/sh3/sh3/coff_exec.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: coff_exec.c,v 1.17 2002/10/05 22:34:03 chs Exp $	*/
+/*	$NetBSD: coff_exec.c,v 1.18 2003/06/28 14:21:06 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Scott Bartram
@@ -62,11 +62,12 @@
  */
 
 int
-exec_coff_makecmds(struct proc *p, struct exec_package *epp)
+exec_coff_makecmds(struct lwp *l, struct exec_package *epp)
 {
 	int error;
 	struct coff_filehdr *fp = epp->ep_hdr;
 	struct coff_aouthdr *ap;
+	struct proc *p;
 
 	if (epp->ep_hdrvalid < COFF_HDR_SIZE)
 		return ENOEXEC;
@@ -74,6 +75,7 @@
 	if (COFF_BADMAG(fp))
 		return ENOEXEC;
 
+	p = l->l_proc;
 	ap = (void *)((char *)epp->ep_hdr + sizeof(struct coff_filehdr));
 	switch (ap->a_magic) {
 	case COFF_OMAGIC:
@@ -417,7 +419,7 @@
 
 #if 0
 int
-coff_load_shlib(struct proc *p, char *path, struct exec_package *epp)
+coff_load_shlib(struct lwp *l, char *path, struct exec_package *epp)
 {
 	int error, siz, resid;
 	int taddr, tsize, daddr, dsize, offset;
@@ -434,7 +436,7 @@
 #ifdef TODO
 	IBCS2_CHECK_ALT_EXIST(p, &sg, path);
 #endif
-	NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, p);
+	NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, l);
 	/* first get the vnode */
 	if ((error = namei(&nd)) != 0) {
 		DPRINTF(("coff_load_shlib: can't find library %s\n", path));
--- a/sys/arch/sh3/sh3/exception.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/sh3/sh3/exception.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: exception.c,v 1.6 2003/03/09 16:14:29 tsutsui Exp $	*/
+/*	$NetBSD: exception.c,v 1.7 2003/06/28 14:21:06 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@@ -541,7 +541,7 @@
 	userret(l);
 #ifdef KTRACE
 	if (KTRPOINT(p, KTR_SYSRET))
-		ktrsysret(p, SYS_fork, 0, 0);
+		ktrsysret(l, SYS_fork, 0, 0);
 #endif
 }
 
--- a/sys/arch/sh5/sh5/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/sh5/sh5/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.8 2003/04/02 02:45:36 thorpej Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.9 2003/06/28 14:21:06 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.8 2003/04/02 02:45:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.9 2003/06/28 14:21:06 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -382,7 +382,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio_direct: USERSPACE but no proc");
--- a/sys/arch/sh5/sh5/syscall.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/sh5/sh5/syscall.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: syscall.c,v 1.8 2003/03/19 11:37:58 scw Exp $	*/
+/*	$NetBSD: syscall.c,v 1.9 2003/06/28 14:21:06 darrenr Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -424,6 +424,6 @@
 
 #ifdef KTRACE
 	if (KTRPOINT(l->l_proc, KTR_SYSRET))
-		ktrsysret(l->l_proc, SYS_fork, 0, 0);
+		ktrsysret(l, SYS_fork, 0, 0);
 #endif
 }
--- a/sys/arch/sparc/sparc/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/sparc/sparc/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.225 2003/06/23 11:01:39 martin Exp $ */
+/*	$NetBSD: machdep.c,v 1.226 2003/06/28 14:21:07 darrenr Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -1226,8 +1226,8 @@
 }
 
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	return (ENOEXEC);
--- a/sys/arch/sparc/sparc/trap.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/sparc/sparc/trap.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.134 2003/06/23 11:01:42 martin Exp $ */
+/*	$NetBSD: trap.c,v 1.135 2003/06/28 14:21:07 darrenr Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -1449,7 +1449,7 @@
 	p = l->l_proc;
 	if (KTRPOINT(p, KTR_SYSRET)) {
 		KERNEL_PROC_LOCK(l);
-		ktrsysret(p,
+		ktrsysret(l,
 			  (p->p_flag & P_PPWAIT) ? SYS_vfork : SYS_fork, 0, 0);
 		KERNEL_PROC_UNLOCK(l);
 	}
--- a/sys/arch/sparc64/sparc64/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/sparc64/sparc64/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.142 2003/05/17 01:38:40 nakayama Exp $ */
+/*	$NetBSD: machdep.c,v 1.143 2003/06/28 14:21:08 darrenr Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -1178,8 +1178,8 @@
 
 
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	return (ENOEXEC);
@@ -1443,7 +1443,7 @@
 	bus_dma_segment_t segs[MAX_DMA_SEGS];
 	int i, j;
 	size_t len;
-	struct proc *p = uio->uio_procp;
+	struct proc *p = uio->uio_lwp->l_proc;
 	struct pmap *pm;
 
 	/*
--- a/sys/arch/sparc64/sparc64/mem.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/sparc64/sparc64/mem.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: mem.c,v 1.25 2003/04/01 16:34:59 thorpej Exp $ */
+/*	$NetBSD: mem.c,v 1.26 2003/06/28 14:21:09 darrenr Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -144,7 +144,7 @@
 			/* However, we do need to partially re-implement uiomove() */
 			if (uio->uio_rw != UIO_READ && uio->uio_rw != UIO_WRITE)
 				panic("mmrw: uio mode");
-			if (uio->uio_segflg == UIO_USERSPACE && uio->uio_procp != curlwp)
+			if (uio->uio_segflg == UIO_USERSPACE && uio->uio_lwp != curlwp)
 				panic("mmrw: uio proc");
 			while (c > 0 && uio->uio_resid) {
 				struct iovec *iov;
--- a/sys/arch/sparc64/sparc64/trap.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/sparc64/sparc64/trap.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.89 2003/05/15 12:56:17 dsl Exp $ */
+/*	$NetBSD: trap.c,v 1.90 2003/06/28 14:21:09 darrenr Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -1939,7 +1939,7 @@
 		
 #ifdef KTRACE
 		if (KTRPOINT(p, KTR_SYSCALL))
-			ktrsyscall(p, code, code, NULL, (register_t *)args.l);
+			ktrsyscall(l, code, code, NULL, (register_t *)args.l);
 #endif
 		if (error)
 			goto bad;
@@ -2012,9 +2012,9 @@
 			i = callp->sy_narg;
 			for (j = 0; j < i; j++) 
 				temp[j] = args.i[j];
-			ktrsyscall(p, code, code, NULL, (register_t *)temp);
+			ktrsyscall(l, code, code, NULL, (register_t *)temp);
 #else
-			ktrsyscall(p, code, code, NULL, (register_t *)&args.i);
+			ktrsyscall(l, code, code, NULL, (register_t *)&args.i);
 #endif
 		}
 #endif /* KTRACE */
@@ -2132,7 +2132,7 @@
 	userret(l, pc, sticks);
 #ifdef KTRACE
 	if (KTRPOINT(p, KTR_SYSRET))
-		ktrsysret(p, code, error, rval);
+		ktrsysret(l, code, error, rval);
 #endif
 	share_fpu(l, tf);
 #ifdef DEBUG
@@ -2165,7 +2165,7 @@
 	userret(l, l->l_md.md_tf->tf_pc, 0);
 #ifdef KTRACE
 	if (KTRPOINT(p, KTR_SYSRET))
-		ktrsysret(p,
+		ktrsysret(l,
 			  (p->p_flag & P_PPWAIT) ? SYS_vfork : SYS_fork, 0, 0);
 #endif
 }
--- a/sys/arch/sun2/sun2/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/sun2/sun2/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.25 2003/06/23 11:01:44 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.26 2003/06/28 14:21:10 darrenr Exp $	*/
 
 /*
  * Copyright (c) 2001 Matthew Fredette.
@@ -842,8 +842,8 @@
  * understand and, if so, set up the vmcmds for it.
  */
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	return ENOEXEC;
--- a/sys/arch/sun3/sun3/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/sun3/sun3/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.163 2003/04/26 11:05:21 ragge Exp $	*/
+/*	$NetBSD: machdep.c,v 1.164 2003/06/28 14:21:11 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Gordon W. Ross
@@ -762,8 +762,8 @@
  * understand and, if so, set up the vmcmds for it.
  */
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	return ENOEXEC;
--- a/sys/arch/sun3/sun3x/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/sun3/sun3x/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.87 2003/04/26 11:05:21 ragge Exp $	*/
+/*	$NetBSD: machdep.c,v 1.88 2003/06/28 14:21:11 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -764,8 +764,8 @@
  * understand and, if so, set up the vmcmds for it.
  */
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	return ENOEXEC;
--- a/sys/arch/vax/vax/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/vax/vax/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.17 2003/04/01 15:23:07 thorpej Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.18 2003/06/28 14:21:12 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -269,7 +269,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/vax/vax/trap.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/vax/vax/trap.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.78 2003/03/01 21:52:00 matt Exp $     */
+/*	$NetBSD: trap.c,v 1.79 2003/06/28 14:21:12 darrenr Exp $     */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -466,7 +466,7 @@
 #ifdef KTRACE
 	if (KTRPOINT(l->l_proc, KTR_SYSRET)) {
 		KERNEL_PROC_LOCK(l);
-		ktrsysret(l->l_proc, SYS_fork, 0, 0);
+		ktrsysret(l, SYS_fork, 0, 0);
 		KERNEL_PROC_UNLOCK(l);
 	}
 #endif
--- a/sys/arch/vax/vax/vm_machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/vax/vax/vm_machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.80 2003/06/23 11:01:50 martin Exp $	     */
+/*	$NetBSD: vm_machdep.c,v 1.81 2003/06/28 14:21:12 darrenr Exp $	     */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -225,8 +225,8 @@
 }
 
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	return ENOEXEC;
--- a/sys/arch/x68k/x68k/bus.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/x68k/x68k/bus.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.20 2003/04/01 15:14:20 thorpej Exp $	*/
+/*	$NetBSD: bus.c,v 1.21 2003/06/28 14:21:13 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -255,7 +255,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp->l_proc;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
--- a/sys/arch/x68k/x68k/machdep.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/x68k/x68k/machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.115 2003/05/01 18:38:54 he Exp $	*/
+/*	$NetBSD: machdep.c,v 1.116 2003/06/28 14:21:13 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1059,8 +1059,8 @@
  *	done on little-endian machines...  -- cgd
  */
 int
-cpu_exec_aout_makecmds(p, epp)
-	struct proc *p;
+cpu_exec_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 #if defined(COMPAT_NOMID) || defined(COMPAT_44)
@@ -1078,12 +1078,12 @@
 	switch (midmag) {
 #ifdef COMPAT_NOMID
 	case (MID_ZERO << 16) | ZMAGIC:
-		error = exec_aout_prep_oldzmagic(p, epp);
+		error = exec_aout_prep_oldzmagic(l->l_proc, epp);
 		break;
 #endif
 #ifdef COMPAT_44
 	case (MID_HP300 << 16) | ZMAGIC:
-		error = exec_aout_prep_oldzmagic(p, epp);
+		error = exec_aout_prep_oldzmagic(l->l_proc, epp);
 		break;
 #endif
 	default:
--- a/sys/arch/x86/x86/bus_dma.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/arch/x86/x86/bus_dma.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.4 2003/06/11 21:36:49 fvdl Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.5 2003/06/28 14:21:13 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.4 2003/06/11 21:36:49 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.5 2003/06/28 14:21:13 darrenr Exp $");
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -459,7 +459,7 @@
 	iov = uio->uio_iov;
 
 	if (uio->uio_segflg == UIO_USERSPACE) {
-		p = uio->uio_procp;
+		p = uio->uio_lwp ? uio->uio_lwp->l_proc : NULL;
 #ifdef DIAGNOSTIC
 		if (p == NULL)
 			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
@@ -823,7 +823,7 @@
 	int i;
 
 	iov = uio->uio_iov;
-	p = uio->uio_procp;
+	p = uio->uio_lwp->l_proc;
 	cp = buf;
 	resid = n;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/x86/x86/bus_machdep.c	Sat Jun 28 14:20:43 2003 +0000
@@ -0,0 +1,1115 @@
+/*	$NetBSD: bus_machdep.c,v 1.4 2003/06/28 14:21:14 darrenr Exp $	*/
+
+/*-
+ * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum and by Jason R. Thorpe of the Numerical Aerospace
+ * Simulation Facility, NASA Ames Research Center.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the NetBSD
+ *	Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: bus_machdep.c,v 1.4 2003/06/28 14:21:14 darrenr Exp $");
+
+#include "opt_largepages.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/extent.h>
+#include <sys/proc.h>
+
+#include <uvm/uvm_extern.h>
+
+#define _X86_BUS_DMA_PRIVATE
+#include <machine/bus.h>
+
+#include <dev/isa/isareg.h>
+#include <machine/isa_machdep.h>
+
+/*
+ * Extent maps to manage I/O and memory space.  Allocate
+ * storage for 8 regions in each, initially.  Later, ioport_malloc_safe
+ * will indicate that it's safe to use malloc() to dynamically allocate
+ * region descriptors.
+ *
+ * N.B. At least two regions are _always_ allocated from the iomem
+ * extent map; (0 -> ISA hole) and (end of ISA hole -> end of RAM).
+ *
+ * The extent maps are not static!  Machine-dependent ISA and EISA
+ * routines need access to them for bus address space allocation.
+ */
+static	long ioport_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
+static	long iomem_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
+struct	extent *ioport_ex;
+struct	extent *iomem_ex;
+static	int ioport_malloc_safe;
+
+int	x86_mem_add_mapping __P((bus_addr_t, bus_size_t,
+	    int, bus_space_handle_t *));
+
+int	_bus_dmamap_load_buffer __P((bus_dma_tag_t, bus_dmamap_t, void *,
+	    bus_size_t, struct proc *, int, paddr_t *, int *, int));
+
+void
+x86_bus_space_init()
+{
+	/*
+	 * Initialize the I/O port and I/O mem extent maps.
+	 * Note: we don't have to check the return value since
+	 * creation of a fixed extent map will never fail (since
+	 * descriptor storage has already been allocated).
+	 *
+	 * N.B. The iomem extent manages _all_ physical addresses
+	 * on the machine.  When the amount of RAM is found, the two
+	 * extents of RAM are allocated from the map (0 -> ISA hole
+	 * and end of ISA hole -> end of RAM).
+	 */
+	ioport_ex = extent_create("ioport", 0x0, 0xffff, M_DEVBUF,
+	    (caddr_t)ioport_ex_storage, sizeof(ioport_ex_storage),
+	    EX_NOCOALESCE|EX_NOWAIT);
+	iomem_ex = extent_create("iomem", 0x0, 0xffffffff, M_DEVBUF,
+	    (caddr_t)iomem_ex_storage, sizeof(iomem_ex_storage),
+	    EX_NOCOALESCE|EX_NOWAIT);
+}
+
+void
+x86_bus_space_mallocok()
+{
+
+	ioport_malloc_safe = 1;
+}
+
+int
+x86_memio_map(t, bpa, size, flags, bshp)
+	bus_space_tag_t t;
+	bus_addr_t bpa;
+	bus_size_t size;
+	int flags;
+	bus_space_handle_t *bshp;
+{
+	int error;
+	struct extent *ex;
+
+	/*
+	 * Pick the appropriate extent map.
+	 */
+	if (t == X86_BUS_SPACE_IO) {
+		if (flags & BUS_SPACE_MAP_LINEAR)
+			return (EOPNOTSUPP);
+		ex = ioport_ex;
+	} else if (t == X86_BUS_SPACE_MEM)
+		ex = iomem_ex;
+	else
+		panic("x86_memio_map: bad bus space tag");
+
+	/*
+	 * Before we go any further, let's make sure that this
+	 * region is available.
+	 */
+	error = extent_alloc_region(ex, bpa, size,
+	    EX_NOWAIT | (ioport_malloc_safe ? EX_MALLOCOK : 0));
+	if (error)
+		return (error);
+
+	/*
+	 * For I/O space, that's all she wrote.
+	 */
+	if (t == X86_BUS_SPACE_IO) {
+		*bshp = bpa;
+		return (0);
+	}
+
+	if (bpa >= IOM_BEGIN && (bpa + size) <= IOM_END) {
+		*bshp = (bus_space_handle_t)ISA_HOLE_VADDR(bpa);
+		return(0);
+	}
+
+	/*
+	 * For memory space, map the bus physical address to
+	 * a kernel virtual address.
+	 */
+	error = x86_mem_add_mapping(bpa, size,
+		(flags & BUS_SPACE_MAP_CACHEABLE) != 0, bshp);
+	if (error) {
+		if (extent_free(ex, bpa, size, EX_NOWAIT |
+		    (ioport_malloc_safe ? EX_MALLOCOK : 0))) {
+			printf("x86_memio_map: pa 0x%lx, size 0x%lx\n",
+			    bpa, size);
+			printf("x86_memio_map: can't free region\n");
+		}
+	}
+
+	return (error);
+}
+
+int
+_x86_memio_map(t, bpa, size, flags, bshp)
+	bus_space_tag_t t;
+	bus_addr_t bpa;
+	bus_size_t size;
+	int flags;
+	bus_space_handle_t *bshp;
+{
+
+	/*
+	 * For I/O space, just fill in the handle.
+	 */
+	if (t == X86_BUS_SPACE_IO) {
+		if (flags & BUS_SPACE_MAP_LINEAR)
+			return (EOPNOTSUPP);
+		*bshp = bpa;
+		return (0);
+	}
+
+	/*
+	 * For memory space, map the bus physical address to
+	 * a kernel virtual address.
+	 */
+	return (x86_mem_add_mapping(bpa, size,
+	    (flags & BUS_SPACE_MAP_CACHEABLE) != 0, bshp));
+}
+
+int
+x86_memio_alloc(t, rstart, rend, size, alignment, boundary, flags,
+    bpap, bshp)
+	bus_space_tag_t t;
+	bus_addr_t rstart, rend;
+	bus_size_t size, alignment, boundary;
+	int flags;
+	bus_addr_t *bpap;
+	bus_space_handle_t *bshp;
+{
+	struct extent *ex;
+	u_long bpa;
+	int error;
+
+	/*
+	 * Pick the appropriate extent map.
+	 */
+	if (t == X86_BUS_SPACE_IO) {
+		if (flags & BUS_SPACE_MAP_LINEAR)
+			return (EOPNOTSUPP);
+		ex = ioport_ex;
+	} else if (t == X86_BUS_SPACE_MEM)
+		ex = iomem_ex;
+	else
+		panic("x86_memio_alloc: bad bus space tag");
+
+	/*
+	 * Sanity check the allocation against the extent's boundaries.
+	 */
+	if (rstart < ex->ex_start || rend > ex->ex_end)
+		panic("x86_memio_alloc: bad region start/end");
+
+	/*
+	 * Do the requested allocation.
+	 */
+	error = extent_alloc_subregion(ex, rstart, rend, size, alignment,
+	    boundary,
+	    EX_FAST | EX_NOWAIT | (ioport_malloc_safe ?  EX_MALLOCOK : 0),
+	    &bpa);
+
+	if (error)
+		return (error);
+
+	/*
+	 * For I/O space, that's all she wrote.
+	 */
+	if (t == X86_BUS_SPACE_IO) {
+		*bshp = *bpap = bpa;
+		return (0);
+	}
+
+	/*
+	 * For memory space, map the bus physical address to
+	 * a kernel virtual address.
+	 */
+	error = x86_mem_add_mapping(bpa, size,
+	    (flags & BUS_SPACE_MAP_CACHEABLE) != 0, bshp);
+	if (error) {
+		if (extent_free(iomem_ex, bpa, size, EX_NOWAIT |
+		    (ioport_malloc_safe ? EX_MALLOCOK : 0))) {
+			printf("x86_memio_alloc: pa 0x%lx, size 0x%lx\n",
+			    bpa, size);
+			printf("x86_memio_alloc: can't free region\n");
+		}
+	}
+
+	*bpap = bpa;
+
+	return (error);
+}
+
+int
+x86_mem_add_mapping(bpa, size, cacheable, bshp)
+	bus_addr_t bpa;
+	bus_size_t size;
+	int cacheable;
+	bus_space_handle_t *bshp;
+{
+	u_long pa, endpa;
+	vaddr_t va;
+	pt_entry_t *pte;
+	int32_t cpumask = 0;
+
+	pa = x86_trunc_page(bpa);
+	endpa = x86_round_page(bpa + size);
+
+#ifdef DIAGNOSTIC
+	if (endpa <= pa)
+		panic("x86_mem_add_mapping: overflow");
+#endif
+
+	va = uvm_km_valloc(kernel_map, endpa - pa);
+	if (va == 0)
+		return (ENOMEM);
+
+	*bshp = (bus_space_handle_t)(va + (bpa & PGOFSET));
+
+	for (; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
+		pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
+
+		/*
+		 * PG_N doesn't exist on 386's, so we assume that
+		 * the mainboard has wired up device space non-cacheable
+		 * on those machines.
+		 *
+		 * Note that it's not necessary to use atomic ops to
+		 * fiddle with the PTE here, because we don't care
+		 * about mod/ref information.
+		 *
+		 * XXX should hand this bit to pmap_kenter_pa to
+		 * save the extra invalidate!
+		 *
+		 * XXX extreme paranoia suggests tlb shootdown belongs here.
+		 */
+		if (pmap_cpu_has_pg_n()) {
+			pte = kvtopte(va);
+			if (cacheable)
+				*pte &= ~PG_N;
+			else
+				*pte |= PG_N;
+			pmap_tlb_shootdown(pmap_kernel(), va, *pte,
+			    &cpumask);
+		}
+	}
+
+	pmap_tlb_shootnow(cpumask);
+	pmap_update(pmap_kernel());
+
+	return 0;
+}
+
+/*
+ * void _x86_memio_unmap(bus_space_tag bst, bus_space_handle bsh,
+ *                        bus_size_t size, bus_addr_t *adrp)
+ *
+ *   This function unmaps memory- or io-space mapped by the function
+ *   _x86_memio_map().  This function works nearly as same as
+ *   x86_memio_unmap(), but this function does not ask kernel
+ *   built-in extents and returns physical address of the bus space,
+ *   for the convenience of the extra extent manager.
+ */
+void
+_x86_memio_unmap(t, bsh, size, adrp)
+	bus_space_tag_t t;
+	bus_space_handle_t bsh;
+	bus_size_t size;
+	bus_addr_t *adrp;
+{
+	u_long va, endva;
+	bus_addr_t bpa;
+
+	/*
+	 * Find the correct extent and bus physical address.
+	 */
+	if (t == X86_BUS_SPACE_IO) {
+		bpa = bsh;
+	} else if (t == X86_BUS_SPACE_MEM) {
+		if (bsh >= atdevbase && (bsh + size) <= (atdevbase + IOM_SIZE)) {
+			bpa = (bus_addr_t)ISA_PHYSADDR(bsh);
+		} else {
+
+			va = x86_trunc_page(bsh);
+			endva = x86_round_page(bsh + size);
+
+#ifdef DIAGNOSTIC
+			if (endva <= va) {
+				panic("_x86_memio_unmap: overflow");
+			}
+#endif
+
+#if __NetBSD_Version__ > 104050000
+			if (pmap_extract(pmap_kernel(), va, &bpa) == FALSE) {
+				panic("_x86_memio_unmap:"
+				    " wrong virtual address");
+			}
+			bpa += (bsh & PGOFSET);
+#else
+			bpa = pmap_extract(pmap_kernel(), va) + (bsh & PGOFSET);
+#endif
+
+			/*
+			 * Free the kernel virtual mapping.
+			 */
+			uvm_km_free(kernel_map, va, endva - va);
+		}
+	} else {
+		panic("_x86_memio_unmap: bad bus space tag");
+	}
+
+	if (adrp != NULL) {
+		*adrp = bpa;
+	}
+}
+
+void
+x86_memio_unmap(t, bsh, size)
+	bus_space_tag_t t;
+	bus_space_handle_t bsh;
+	bus_size_t size;
+{
+	struct extent *ex;
+	u_long va, endva;
+	bus_addr_t bpa;
+
+	/*
+	 * Find the correct extent and bus physical address.
+	 */
+	if (t == X86_BUS_SPACE_IO) {
+		ex = ioport_ex;
+		bpa = bsh;
+	} else if (t == X86_BUS_SPACE_MEM) {
+		ex = iomem_ex;
+
+		if (bsh >= atdevbase &&
+		    (bsh + size) <= (atdevbase + IOM_SIZE)) {
+			bpa = (bus_addr_t)ISA_PHYSADDR(bsh);
+			goto ok;
+		}
+
+		va = x86_trunc_page(bsh);
+		endva = x86_round_page(bsh + size);
+
+#ifdef DIAGNOSTIC
+		if (endva <= va)
+			panic("x86_memio_unmap: overflow");
+#endif
+
+		(void) pmap_extract(pmap_kernel(), va, &bpa);
+		bpa += (bsh & PGOFSET);
+
+		/*
+		 * Free the kernel virtual mapping.
+		 */
+		uvm_km_free(kernel_map, va, endva - va);
+	} else
+		panic("x86_memio_unmap: bad bus space tag");
+
+ok:
+	if (extent_free(ex, bpa, size,
+	    EX_NOWAIT | (ioport_malloc_safe ? EX_MALLOCOK : 0))) {
+		printf("x86_memio_unmap: %s 0x%lx, size 0x%lx\n",
+		    (t == X86_BUS_SPACE_IO) ? "port" : "pa", bpa, size);
+		printf("x86_memio_unmap: can't free region\n");
+	}
+}
+
+void
+x86_memio_free(t, bsh, size)
+	bus_space_tag_t t;
+	bus_space_handle_t bsh;
+	bus_size_t size;
+{
+
+	/* x86_memio_unmap() does all that we need to do. */
+	x86_memio_unmap(t, bsh, size);
+}
+
+int
+x86_memio_subregion(t, bsh, offset, size, nbshp)
+	bus_space_tag_t t;
+	bus_space_handle_t bsh;
+	bus_size_t offset, size;
+	bus_space_handle_t *nbshp;
+{
+
+	*nbshp = bsh + offset;
+	return (0);
+}
+
+paddr_t
+x86_memio_mmap(t, addr, off, prot, flags)
+	bus_space_tag_t t;
+	bus_addr_t addr;
+	off_t off;
+	int prot;
+	int flags;
+{
+
+	/* Can't mmap I/O space. */
+	if (t == X86_BUS_SPACE_IO)
+		return (-1);
+
+	/*
+	 * "addr" is the base address of the device we're mapping.
+	 * "off" is the offset into that device.
+	 *
+	 * Note we are called for each "page" in the device that
+	 * the upper layers want to map.
+	 */
+	return (x86_btop(addr + off));
+}
+
+/*
+ * Common function for DMA map creation.  May be called by bus-specific
+ * DMA map creation functions.
+ */
+int
+_bus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
+	bus_dma_tag_t t;
+	bus_size_t size;
+	int nsegments;
+	bus_size_t maxsegsz;
+	bus_size_t boundary;
+	int flags;
+	bus_dmamap_t *dmamp;
+{
+	struct x86_bus_dmamap *map;
+	void *mapstore;
+	size_t mapsize;
+
+	/*
+	 * Allocate and initialize the DMA map.  The end of the map
+	 * is a variable-sized array of segments, so we allocate enough
+	 * room for them in one shot.
+	 *
+	 * Note we don't preserve the WAITOK or NOWAIT flags.  Preservation
+	 * of ALLOCNOW notifies others that we've reserved these resources,
+	 * and they are not to be freed.
+	 *
+	 * The bus_dmamap_t includes one bus_dma_segment_t, hence
+	 * the (nsegments - 1).
+	 */
+	mapsize = sizeof(struct x86_bus_dmamap) +
+	    (sizeof(bus_dma_segment_t) * (nsegments - 1));
+	if ((mapstore = malloc(mapsize, M_DMAMAP,
+	    (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
+		return (ENOMEM);
+
+	memset(mapstore, 0, mapsize);
+	map = (struct x86_bus_dmamap *)mapstore;
+	map->_dm_size = size;
+	map->_dm_segcnt = nsegments;
+	map->_dm_maxsegsz = maxsegsz;
+	map->_dm_boundary = boundary;
+	map->_dm_bounce_thresh = t->_bounce_thresh;
+	map->_dm_flags = flags & ~(BUS_DMA_WAITOK|BUS_DMA_NOWAIT);
+	map->dm_mapsize = 0;		/* no valid mappings */
+	map->dm_nsegs = 0;
+
+	*dmamp = map;
+	return (0);
+}
+
+/*
+ * Common function for DMA map destruction.  May be called by bus-specific
+ * DMA map destruction functions.
+ */
+void
+_bus_dmamap_destroy(t, map)
+	bus_dma_tag_t t;
+	bus_dmamap_t map;
+{
+
+	free(map, M_DMAMAP);
+}
+
+/*
+ * Common function for loading a DMA map with a linear buffer.  May
+ * be called by bus-specific DMA map load functions.
+ */
+int
+_bus_dmamap_load(t, map, buf, buflen, p, flags)
+	bus_dma_tag_t t;
+	bus_dmamap_t map;
+	void *buf;
+	bus_size_t buflen;
+	struct proc *p;
+	int flags;
+{
+	paddr_t lastaddr;
+	int seg, error;
+
+	/*
+	 * Make sure that on error condition we return "no valid mappings".
+	 */
+	map->dm_mapsize = 0;
+	map->dm_nsegs = 0;
+
+	if (buflen > map->_dm_size)
+		return (EINVAL);
+
+	seg = 0;
+	error = _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags,
+	    &lastaddr, &seg, 1);
+	if (error == 0) {
+		map->dm_mapsize = buflen;
+		map->dm_nsegs = seg + 1;
+	}
+	return (error);
+}
+
+/*
+ * Like _bus_dmamap_load(), but for mbufs.
+ */
+int
+_bus_dmamap_load_mbuf(t, map, m0, flags)
+	bus_dma_tag_t t;
+	bus_dmamap_t map;
+	struct mbuf *m0;
+	int flags;
+{
+	paddr_t lastaddr;
+	int seg, error, first;
+	struct mbuf *m;
+
+	/*
+	 * Make sure that on error condition we return "no valid mappings."
+	 */
+	map->dm_mapsize = 0;
+	map->dm_nsegs = 0;
+
+#ifdef DIAGNOSTIC
+	if ((m0->m_flags & M_PKTHDR) == 0)
+		panic("_bus_dmamap_load_mbuf: no packet header");
+#endif
+
+	if (m0->m_pkthdr.len > map->_dm_size)
+		return (EINVAL);
+
+	first = 1;
+	seg = 0;
+	error = 0;
+	for (m = m0; m != NULL && error == 0; m = m->m_next) {
+		error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
+		    NULL, flags, &lastaddr, &seg, first);
+		first = 0;
+	}
+	if (error == 0) {
+		map->dm_mapsize = m0->m_pkthdr.len;
+		map->dm_nsegs = seg + 1;
+	}
+	return (error);
+}
+
+/*
+ * Like _bus_dmamap_load(), but for uios.
+ */
+int
+_bus_dmamap_load_uio(t, map, uio, flags)
+	bus_dma_tag_t t;
+	bus_dmamap_t map;
+	struct uio *uio;
+	int flags;
+{
+	paddr_t lastaddr;
+	int seg, i, error, first;
+	bus_size_t minlen, resid;
+	struct proc *p = NULL;
+	struct iovec *iov;
+	caddr_t addr;
+
+	/*
+	 * Make sure that on error condition we return "no valid mappings."
+	 */
+	map->dm_mapsize = 0;
+	map->dm_nsegs = 0;
+
+	resid = uio->uio_resid;
+	iov = uio->uio_iov;
+
+	if (uio->uio_segflg == UIO_USERSPACE) {
+		p = uio->uio_lwp->l_proc;
+#ifdef DIAGNOSTIC
+		if (p == NULL)
+			panic("_bus_dmamap_load_uio: USERSPACE but no proc");
+#endif
+	}
+
+	first = 1;
+	seg = 0;
+	error = 0;
+	for (i = 0; i < uio->uio_iovcnt && resid != 0 && error == 0; i++) {
+		/*
+		 * Now at the first iovec to load.  Load each iovec
+		 * until we have exhausted the residual count.
+		 */
+		minlen = resid < iov[i].iov_len ? resid : iov[i].iov_len;
+		addr = (caddr_t)iov[i].iov_base;
+
+		error = _bus_dmamap_load_buffer(t, map, addr, minlen,
+		    p, flags, &lastaddr, &seg, first);
+		first = 0;
+
+		resid -= minlen;
+	}
+	if (error == 0) {
+		map->dm_mapsize = uio->uio_resid;
+		map->dm_nsegs = seg + 1;
+	}
+	return (error);
+}
+
+/*
+ * Like _bus_dmamap_load(), but for raw memory allocated with
+ * bus_dmamem_alloc().
+ */
+int
+_bus_dmamap_load_raw(t, map, segs, nsegs, size, flags)
+	bus_dma_tag_t t;
+	bus_dmamap_t map;
+	bus_dma_segment_t *segs;
+	int nsegs;
+	bus_size_t size;
+	int flags;
+{
+
+	panic("_bus_dmamap_load_raw: not implemented");
+}
+
+/*
+ * Common function for unloading a DMA map.  May be called by
+ * bus-specific DMA map unload functions.
+ */
+void
+_bus_dmamap_unload(t, map)
+	bus_dma_tag_t t;
+	bus_dmamap_t map;
+{
+
+	/*
+	 * No resources to free; just mark the mappings as
+	 * invalid.
+	 */
+	map->dm_mapsize = 0;
+	map->dm_nsegs = 0;
+}
+
+/*
+ * Common function for DMA map synchronization.  May be called
+ * by bus-specific DMA map synchronization functions.
+ */
+void
+_bus_dmamap_sync(t, map, offset, len, ops)
+	bus_dma_tag_t t;
+	bus_dmamap_t map;
+	bus_addr_t offset;
+	bus_size_t len;
+	int ops;
+{
+
+	/* Nothing to do here. */
+}
+
+/*
+ * Common function for DMA-safe memory allocation.  May be called
+ * by bus-specific DMA memory allocation functions.
+ */
+int
+_bus_dmamem_alloc(t, size, alignment, boundary, segs, nsegs, rsegs, flags)
+	bus_dma_tag_t t;
+	bus_size_t size, alignment, boundary;
+	bus_dma_segment_t *segs;
+	int nsegs;
+	int *rsegs;
+	int flags;
+{
+	extern paddr_t avail_end;
+	paddr_t high;
+
+	/*
+	 * XXX restrict PCI to 32 bits for now.
+	 */
+	high = trunc_page(avail_end);
+	if (/* CONSTCOND */ sizeof (paddr_t) > 4)
+		high =  high > 0xffffffff ? 0xffffffff : high;
+
+	return (_bus_dmamem_alloc_range(t, size, alignment, boundary,
+	    segs, nsegs, rsegs, flags, 0, high));
+}
+
+/*
+ * Common function for freeing DMA-safe memory.  May be called by
+ * bus-specific DMA memory free functions.
+ */
+void
+_bus_dmamem_free(t, segs, nsegs)
+	bus_dma_tag_t t;
+	bus_dma_segment_t *segs;
+	int nsegs;
+{
+	struct vm_page *m;
+	bus_addr_t addr;
+	struct pglist mlist;
+	int curseg;
+
+	/*
+	 * Build a list of pages to free back to the VM system.
+	 */
+	TAILQ_INIT(&mlist);
+	for (curseg = 0; curseg < nsegs; curseg++) {
+		for (addr = segs[curseg].ds_addr;
+		    addr < (segs[curseg].ds_addr + segs[curseg].ds_len);
+		    addr += PAGE_SIZE) {
+			m = PHYS_TO_VM_PAGE(addr);
+			TAILQ_INSERT_TAIL(&mlist, m, pageq);
+		}
+	}
+
+	uvm_pglistfree(&mlist);
+}
+
+/*
+ * Common function for mapping DMA-safe memory.  May be called by
+ * bus-specific DMA memory map functions.
+ * This supports BUS_DMA_NOCACHE.
+ */
+int
+_bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
+	bus_dma_tag_t t;
+	bus_dma_segment_t *segs;
+	int nsegs;
+	size_t size;
+	caddr_t *kvap;
+	int flags;
+{
+	vaddr_t va;
+	bus_addr_t addr;
+	int curseg;
+	int32_t cpumask;
+	int nocache;
+	int marked;
+	pt_entry_t *pte;
+
+	size = round_page(size);
+	cpumask = 0;
+	nocache = (flags & BUS_DMA_NOCACHE) != 0 && pmap_cpu_has_pg_n();
+	marked = 0;
+
+	va = uvm_km_valloc(kernel_map, size);
+
+	if (va == 0)
+		return (ENOMEM);
+
+	*kvap = (caddr_t)va;
+
+	for (curseg = 0; curseg < nsegs; curseg++) {
+		for (addr = segs[curseg].ds_addr;
+		    addr < (segs[curseg].ds_addr + segs[curseg].ds_len);
+		    addr += PAGE_SIZE, va += PAGE_SIZE, size -= PAGE_SIZE) {
+			if (size == 0)
+				panic("_bus_dmamem_map: size botch");
+			pmap_enter(pmap_kernel(), va, addr,
+			    VM_PROT_READ | VM_PROT_WRITE,
+			    PMAP_WIRED | VM_PROT_READ | VM_PROT_WRITE);
+			/*
+			 * mark page as non-cacheable
+			 */
+			if (nocache) {
+				pte = kvtopte(va);
+				if ((*pte & PG_N) == 0) {
+					*pte |= PG_N;
+					pmap_tlb_shootdown(pmap_kernel(), va,
+					    *pte, &cpumask);
+					marked = 1;
+				}
+			}
+		}
+	}
+	if (marked)
+		pmap_tlb_shootnow(cpumask);
+	pmap_update(pmap_kernel());
+
+	return (0);
+}
+
+/*
+ * Common function for unmapping DMA-safe memory.  May be called by
+ * bus-specific DMA memory unmapping functions.
+ */
+void
+_bus_dmamem_unmap(t, kva, size)
+	bus_dma_tag_t t;
+	caddr_t kva;
+	size_t size;
+{
+	pt_entry_t *pte;
+	vaddr_t va, endva;
+	int cpumask;
+	int marked;
+
+	cpumask = 0;
+	marked = 0;
+#ifdef DIAGNOSTIC
+	if ((u_long)kva & PGOFSET)
+		panic("_bus_dmamem_unmap");
+#endif
+
+	size = round_page(size);
+	/*
+         * mark pages cacheable again.
+         */
+	for (va = (vaddr_t)kva, endva = (vaddr_t)kva + size;
+	     va < endva; va += PAGE_SIZE) {
+		pte = kvtopte(va);
+		if ((*pte & PG_N) != 0) {
+			*pte &= ~PG_N;
+			pmap_tlb_shootdown(pmap_kernel(), va, *pte, &cpumask);
+			marked = 1;
+		}
+	}
+	if (marked)
+		pmap_tlb_shootnow(cpumask);
+
+	uvm_km_free(kernel_map, (vaddr_t)kva, size);
+}
+
+/*
+ * Common functin for mmap(2)'ing DMA-safe memory.  May be called by
+ * bus-specific DMA mmap(2)'ing functions.
+ */
+paddr_t
+_bus_dmamem_mmap(t, segs, nsegs, off, prot, flags)
+	bus_dma_tag_t t;
+	bus_dma_segment_t *segs;
+	int nsegs;
+	off_t off;
+	int prot, flags;
+{
+	int i;
+
+	for (i = 0; i < nsegs; i++) {
+#ifdef DIAGNOSTIC
+		if (off & PGOFSET)
+			panic("_bus_dmamem_mmap: offset unaligned");
+		if (segs[i].ds_addr & PGOFSET)
+			panic("_bus_dmamem_mmap: segment unaligned");
+		if (segs[i].ds_len & PGOFSET)
+			panic("_bus_dmamem_mmap: segment size not multiple"
+			    " of page size");
+#endif
+		if (off >= segs[i].ds_len) {
+			off -= segs[i].ds_len;
+			continue;
+		}
+
+		return (x86_btop((caddr_t)segs[i].ds_addr + off));
+	}
+
+	/* Page not found. */
+	return (-1);
+}
+
+/**********************************************************************
+ * DMA utility functions
+ **********************************************************************/
+
+/*
+ * Utility function to load a linear buffer.  lastaddrp holds state
+ * between invocations (for multiple-buffer loads).  segp contains
+ * the starting segment on entrace, and the ending segment on exit.
+ * first indicates if this is the first invocation of this function.
+ */
+int
+_bus_dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first)
+	bus_dma_tag_t t;
+	bus_dmamap_t map;
+	void *buf;
+	bus_size_t buflen;
+	struct proc *p;
+	int flags;
+	paddr_t *lastaddrp;
+	int *segp;
+	int first;
+{
+	bus_size_t sgsize;
+	bus_addr_t curaddr, lastaddr, baddr, bmask;
+	vaddr_t vaddr = (vaddr_t)buf;
+	int seg;
+	pmap_t pmap;
+
+	if (p != NULL)
+		pmap = p->p_vmspace->vm_map.pmap;
+	else
+		pmap = pmap_kernel();
+
+	lastaddr = *lastaddrp;
+	bmask  = ~(map->_dm_boundary - 1);
+
+	for (seg = *segp; buflen > 0 ; ) {
+		/*
+		 * Get the physical address for this segment.
+		 */
+		(void) pmap_extract(pmap, vaddr, &curaddr);
+
+		/*
+		 * If we're beyond the bounce threshold, notify
+		 * the caller.
+		 */
+		if (map->_dm_bounce_thresh != 0 &&
+		    curaddr >= map->_dm_bounce_thresh)
+			return (EINVAL);
+
+		/*
+		 * Compute the segment size, and adjust counts.
+		 */
+		sgsize = PAGE_SIZE - ((u_long)vaddr & PGOFSET);
+		if (buflen < sgsize)
+			sgsize = buflen;
+
+		/*
+		 * Make sure we don't cross any boundaries.
+		 */
+		if (map->_dm_boundary > 0) {
+			baddr = (curaddr + map->_dm_boundary) & bmask;
+			if (sgsize > (baddr - curaddr))
+				sgsize = (baddr - curaddr);
+		}
+
+		/*
+		 * Insert chunk into a segment, coalescing with
+		 * previous segment if possible.
+		 */
+		if (first) {
+			map->dm_segs[seg].ds_addr = curaddr;
+			map->dm_segs[seg].ds_len = sgsize;
+			first = 0;
+		} else {
+			if (curaddr == lastaddr &&
+			    (map->dm_segs[seg].ds_len + sgsize) <=
+			     map->_dm_maxsegsz &&
+			    (map->_dm_boundary == 0 ||
+			     (map->dm_segs[seg].ds_addr & bmask) ==
+			     (curaddr & bmask)))
+				map->dm_segs[seg].ds_len += sgsize;
+			else {
+				if (++seg >= map->_dm_segcnt)
+					break;
+				map->dm_segs[seg].ds_addr = curaddr;
+				map->dm_segs[seg].ds_len = sgsize;
+			}
+		}
+
+		lastaddr = curaddr + sgsize;
+		vaddr += sgsize;
+		buflen -= sgsize;
+	}
+
+	*segp = seg;
+	*lastaddrp = lastaddr;
+
+	/*
+	 * Did we fit?
+	 */
+	if (buflen != 0)
+		return (EFBIG);		/* XXX better return value here? */
+	return (0);
+}
+
+/*
+ * Allocate physical memory from the given physical address range.
+ * Called by DMA-safe memory allocation methods.
+ */
+int
+_bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
+    flags, low, high)
+	bus_dma_tag_t t;
+	bus_size_t size, alignment, boundary;
+	bus_dma_segment_t *segs;
+	int nsegs;
+	int *rsegs;
+	int flags;
+	paddr_t low;
+	paddr_t high;
+{
+	paddr_t curaddr, lastaddr;
+	struct vm_page *m;
+	struct pglist mlist;
+	int curseg, error;
+
+	/* Always round the size. */
+	size = round_page(size);
+
+	/*
+	 * Allocate pages from the VM system.
+	 */
+	error = uvm_pglistalloc(size, low, high, alignment, boundary,
+	    &mlist, nsegs, (flags & BUS_DMA_NOWAIT) == 0);
+	if (error)
+		return (error);
+
+	/*
+	 * Compute the location, size, and number of segments actually
+	 * returned by the VM code.
+	 */
+	m = mlist.tqh_first;
+	curseg = 0;
+	lastaddr = segs[curseg].ds_addr = VM_PAGE_TO_PHYS(m);
+	segs[curseg].ds_len = PAGE_SIZE;
+	m = m->pageq.tqe_next;
+
+	for (; m != NULL; m = m->pageq.tqe_next) {
+		curaddr = VM_PAGE_TO_PHYS(m);
+#ifdef DIAGNOSTIC
+		if (curaddr < low || curaddr >= high) {
+			printf("vm_page_alloc_memory returned non-sensical"
+			    " address 0x%lx\n", curaddr);
+			panic("_bus_dmamem_alloc_range");
+		}
+#endif
+		if (curaddr == (lastaddr + PAGE_SIZE))
+			segs[curseg].ds_len += PAGE_SIZE;
+		else {
+			curseg++;
+			segs[curseg].ds_addr = curaddr;
+			segs[curseg].ds_len = PAGE_SIZE;
+		}
+		lastaddr = curaddr;
+	}
+
+	*rsegs = curseg + 1;
+
+	return (0);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/x86_64/x86_64/syscall.c	Sat Jun 28 14:20:43 2003 +0000
@@ -0,0 +1,327 @@
+/*	$NetBSD: syscall.c,v 1.12 2003/06/28 14:21:14 darrenr Exp $	*/
+
+/*-
+ * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "opt_syscall_debug.h"
+#include "opt_ktrace.h"
+#include "opt_systrace.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <sys/signal.h>
+#include <sys/sa.h>
+#include <sys/savar.h>
+#ifdef KTRACE
+#include <sys/ktrace.h>
+#endif
+#ifdef SYSTRACE
+#include <sys/systrace.h>
+#endif
+#include <sys/syscall.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <machine/cpu.h>
+#include <machine/psl.h>
+#include <machine/userret.h>
+
+void syscall_intern __P((struct proc *));
+void syscall_plain __P((struct trapframe));
+void syscall_fancy __P((struct trapframe));
+
+void
+syscall_intern(p)
+	struct proc *p;
+{
+#ifdef KTRACE
+	if (p->p_traceflag & (KTRFAC_SYSCALL | KTRFAC_SYSRET)) {
+		p->p_md.md_syscall = syscall_fancy;
+		return;
+	}
+#endif
+#ifdef SYSTRACE
+	if (ISSET(p->p_flag, P_SYSTRACE)) {
+		p->p_md.md_syscall = syscall_fancy;
+		return;
+	} 
+#endif
+	p->p_md.md_syscall = syscall_plain;
+}
+
+/*
+ * syscall(frame):
+ *	System call request from POSIX system call gate interface to kernel.
+ * Like trap(), argument is call by reference.
+ */
+void
+syscall_plain(frame)
+	struct trapframe frame;
+{
+	caddr_t params;
+	const struct sysent *callp;
+	struct proc *p;
+	struct lwp *l;
+	int error;
+	size_t argsize, argoff;
+	register_t code, args[9], rval[2], *argp;
+
+	uvmexp.syscalls++;
+	l = curlwp;
+	p = l->l_proc;
+
+	code = frame.tf_rax;
+	callp = p->p_emul->e_sysent;
+	argoff = 0;
+	argp = &args[0];
+
+	switch (code) {
+	case SYS_syscall:
+	case SYS___syscall:
+		/*
+		 * Code is first argument, followed by actual args.
+		 */
+		code = frame.tf_rdi;
+		argp = &args[1];
+		argoff = 1;
+		break;
+	default:
+		break;
+	}
+
+	code &= (SYS_NSYSENT - 1);
+	callp += code;
+
+	argsize = (callp->sy_argsize >> 3) + argoff;
+	if (argsize) {
+		switch (MIN(argsize, 6)) {
+		case 6:
+			args[5] = frame.tf_r9;
+		case 5:
+			args[4] = frame.tf_r8;
+		case 4:
+			args[3] = frame.tf_r10;
+		case 3:
+			args[2] = frame.tf_rdx;
+		case 2:	
+			args[1] = frame.tf_rsi;
+		case 1:
+			args[0] = frame.tf_rdi;
+			break;
+		default:
+			panic("impossible syscall argsize");
+		}
+		if (argsize > 6) {
+			argsize -= 6;
+			params = (caddr_t)frame.tf_rsp + sizeof(register_t);
+			error = copyin(params, (caddr_t)&args[6],
+					argsize << 3);
+			if (error != 0)
+				goto bad;
+		}
+	}
+
+#ifdef SYSCALL_DEBUG
+	scdebug_call(l, code, argp);
+#endif /* SYSCALL_DEBUG */
+
+	rval[0] = 0;
+	rval[1] = 0;
+	KERNEL_PROC_LOCK(l);
+	error = (*callp->sy_call)(l, argp, rval);
+	KERNEL_PROC_UNLOCK(l);
+
+	switch (error) {
+	case 0:
+		frame.tf_rax = rval[0];
+		frame.tf_rdx = rval[1];
+		frame.tf_rflags &= ~PSL_C;	/* carry bit */
+		break;
+	case ERESTART:
+		/*
+		 * The offset to adjust the PC by depends on whether we entered
+		 * the kernel through the trap or call gate.  We pushed the
+		 * size of the instruction into tf_err on entry.
+		 */
+		frame.tf_rip -= frame.tf_err;
+		break;
+	case EJUSTRETURN:
+		/* nothing to do */
+		break;
+	default:
+	bad:
+		frame.tf_rax = error;
+		frame.tf_rflags |= PSL_C;	/* carry bit */
+		break;
+	}
+
+#ifdef SYSCALL_DEBUG
+	scdebug_ret(l, code, error, rval);
+#endif /* SYSCALL_DEBUG */
+	userret(l);
+}
+
+void
+syscall_fancy(frame)
+	struct trapframe frame;
+{
+	caddr_t params;
+	const struct sysent *callp;
+	struct proc *p;
+	struct lwp *l;
+	int error;
+	size_t argsize, argoff;
+	register_t code, args[9], rval[2], *argp;
+
+	uvmexp.syscalls++;
+	l = curlwp;
+	p = l->l_proc;
+
+	code = frame.tf_rax;
+	callp = p->p_emul->e_sysent;
+	argp = &args[0];
+	argoff = 0;
+
+	switch (code) {
+	case SYS_syscall:
+	case SYS___syscall:
+		/*
+		 * Code is first argument, followed by actual args.
+		 */
+		code = frame.tf_rdi;
+		argp = &args[1];
+		argoff = 1;
+		break;
+	default:
+		break;
+	}
+	code &= (SYS_NSYSENT - 1);
+	callp += code;
+
+	argsize = (callp->sy_argsize >> 3) + argoff;
+	if (argsize) {
+		switch (MIN(argsize, 6)) {
+		case 6:
+			args[5] = frame.tf_r9;
+		case 5:
+			args[4] = frame.tf_r8;
+		case 4:
+			args[3] = frame.tf_r10;
+		case 3:
+			args[2] = frame.tf_rdx;
+		case 2:	
+			args[1] = frame.tf_rsi;
+		case 1:
+			args[0] = frame.tf_rdi;
+			break;
+		default:
+			panic("impossible syscall argsize");
+		}
+		if (argsize > 6) {
+			argsize -= 6;
+			params = (caddr_t)frame.tf_rsp + sizeof(register_t);
+			error = copyin(params, (caddr_t)&args[6],
+					argsize << 3);
+			if (error != 0)
+				goto bad;
+		}
+	}
+
+	KERNEL_PROC_LOCK(l);
+	if ((error = trace_enter(l, code, code, NULL, args, rval)) != 0) {
+		KERNEL_PROC_UNLOCK(l);
+		goto bad;
+	}
+
+	rval[0] = 0;
+	rval[1] = 0;
+	error = (*callp->sy_call)(l, argp, rval);
+	KERNEL_PROC_UNLOCK(l);
+	switch (error) {
+	case 0:
+		frame.tf_rax = rval[0];
+		frame.tf_rdx = rval[1];
+		frame.tf_rflags &= ~PSL_C;	/* carry bit */
+		break;
+	case ERESTART:
+		/*
+		 * The offset to adjust the PC by depends on whether we entered
+		 * the kernel through the trap or call gate.  We pushed the
+		 * size of the instruction into tf_err on entry.
+		 */
+		frame.tf_rip -= frame.tf_err;
+		break;
+	case EJUSTRETURN:
+		/* nothing to do */
+		break;
+	default:
+	bad:
+		frame.tf_rax = error;
+		frame.tf_rflags |= PSL_C;	/* carry bit */
+		break;
+	}
+
+	trace_exit(l, code, args, rval, error);
+
+	userret(l);
+}
+
+void
+child_return(arg)
+	void *arg;
+{
+	struct lwp *l = arg;
+	struct trapframe *tf = l->l_md.md_regs;
+#ifdef KTRACE
+	struct proc *p = l->l_proc;
+#endif
+
+	tf->tf_rax = 0;
+	tf->tf_rflags &= ~PSL_C;
+
+	KERNEL_PROC_UNLOCK(l);
+
+	userret(l);
+#ifdef KTRACE
+	if (KTRPOINT(p, KTR_SYSRET)) {
+		KERNEL_PROC_LOCK(l);
+		ktrsysret(l, SYS_fork, 0, 0);
+		KERNEL_PROC_UNLOCK(l);
+	}
+#endif
+}
--- a/sys/coda/coda_psdev.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/coda/coda_psdev.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_psdev.c,v 1.24 2003/01/24 18:51:53 jdolecek Exp $	*/
+/*	$NetBSD: coda_psdev.c,v 1.25 2003/06/28 14:21:14 darrenr Exp $	*/
 
 /*
  * 
@@ -54,7 +54,7 @@
 /* These routines are the device entry points for Venus. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coda_psdev.c,v 1.24 2003/01/24 18:51:53 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_psdev.c,v 1.25 2003/06/28 14:21:14 darrenr Exp $");
 
 extern int coda_nc_initialized;    /* Set if cache has been initialized */
 
@@ -137,11 +137,11 @@
  * These functions are written for NetBSD.
  */
 int 
-vc_nb_open(dev, flag, mode, p)    
+vc_nb_open(dev, flag, mode, l)    
     dev_t        dev;      
     int          flag;     
     int          mode;     
-    struct proc *p;             /* NetBSD only */
+    struct lwp *l;             /* NetBSD only */
 {
     struct vcomm *vcp;
     
@@ -169,11 +169,11 @@
 }
 
 int 
-vc_nb_close (dev, flag, mode, p)    
+vc_nb_close (dev, flag, mode, l)
     dev_t        dev;      
     int          flag;     
     int          mode;     
-    struct proc *p;
+    struct lwp *l;
 {
     struct vcomm *vcp;
     struct vmsg *vmp, *nvmp = NULL;
@@ -253,7 +253,7 @@
 #endif
     }
 
-    err = dounmount(mi->mi_vfsp, flag, p);
+    err = dounmount(mi->mi_vfsp, flag, l);
     if (err)
 	myprintf(("Error %d unmounting vfs in vcclose(%d)\n", 
 	           err, minor(dev)));
@@ -415,12 +415,12 @@
 }
 
 int
-vc_nb_ioctl(dev, cmd, addr, flag, p) 
+vc_nb_ioctl(dev, cmd, addr, flag, l)
     dev_t         dev;       
     u_long        cmd;       
     caddr_t       addr;      
     int           flag;      
-    struct proc  *p;
+    struct lwp *l;
 {
     ENTRY;
 
@@ -469,10 +469,10 @@
 }
 
 int
-vc_nb_poll(dev, events, p)         
+vc_nb_poll(dev, events, l)
     dev_t         dev;    
     int           events;   
-    struct proc  *p;
+    struct lwp *l;
 {
     struct vcomm *vcp;
     int event_msk = 0;
@@ -491,7 +491,7 @@
     if (!EMPTY(vcp->vc_requests))
 	return(events & (POLLIN|POLLRDNORM));
 
-    selrecord(p, &(vcp->vc_selproc));
+    selrecord(l, &(vcp->vc_selproc));
     
     return(0);
 }
@@ -574,10 +574,11 @@
 	struct vmsg *vmp;
 	int error;
 #ifdef	CTL_C
-	struct proc *p = curproc;
+	struct lwp *l = curlwp;
+	struct proc *p = l->l_proc;
 	sigset_t psig_omask;
 	int i;
-	psig_omask = p->p_sigctx.ps_siglist;	/* array assignment */
+	psig_omask = l->l_proc->p_sigctx.ps_siglist;	/* array assignment */
 #endif
 	if (mntinfo == NULL) {
 	    /* Unlikely, but could be a race condition with a dying warden */
--- a/sys/coda/coda_venus.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/coda/coda_venus.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_venus.c,v 1.13 2002/11/02 07:18:36 perry Exp $	*/
+/*	$NetBSD: coda_venus.c,v 1.14 2003/06/28 14:21:14 darrenr Exp $	*/
 
 /*
  * 
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coda_venus.c,v 1.13 2002/11/02 07:18:36 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_venus.c,v 1.14 2003/06/28 14:21:14 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -167,14 +167,14 @@
 
 int
 venus_root(void *mdp,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	ViceFid *VFid)
 {
     DECL_NO_IN(coda_root);		/* sets Isize & Osize */
     ALLOC_NO_IN(coda_root);		/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(inp, CODA_ROOT, cred, p);  
+    INIT_IN(inp, CODA_ROOT, cred, l->l_proc);
 
     error = coda_call(mdp, Isize, &Osize, (char *)inp);
     if (!error)
@@ -186,7 +186,7 @@
 
 int
 venus_open(void *mdp, ViceFid *fid, int flag,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	dev_t *dev, ino_t *inode)
 {
     int cflag;
@@ -194,7 +194,7 @@
     ALLOC(coda_open);			/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_OPEN, cred, p);
+    INIT_IN(&inp->ih, CODA_OPEN, cred, l->l_proc);
     inp->VFid = *fid;
     CNV_OFLAG(cflag, flag);
     inp->flags = cflag;
@@ -211,13 +211,13 @@
 
 int
 venus_close(void *mdp, ViceFid *fid, int flag,
-	struct ucred *cred, struct proc *p)
+	struct ucred *cred, struct lwp *l)
 {
     int cflag;
     DECL_NO_OUT(coda_close);		/* sets Isize & Osize */
     ALLOC_NO_OUT(coda_close);		/* sets inp & outp */
 
-    INIT_IN(&inp->ih, CODA_CLOSE, cred, p);
+    INIT_IN(&inp->ih, CODA_CLOSE, cred, l->l_proc);
     inp->VFid = *fid;
     CNV_OFLAG(cflag, flag);
     inp->flags = cflag;
@@ -249,7 +249,7 @@
 int
 venus_ioctl(void *mdp, ViceFid *fid,
 	int com, int flag, caddr_t data,
-	struct ucred *cred, struct proc *p)
+	struct ucred *cred, struct lwp *l)
 {
     DECL(coda_ioctl);			/* sets Isize & Osize */
     struct PioctlData *iap = (struct PioctlData *)data;
@@ -258,7 +258,7 @@
     coda_ioctl_size = VC_MAXMSGSIZE;
     ALLOC(coda_ioctl);			/* sets inp & outp */
 
-    INIT_IN(&inp->ih, CODA_IOCTL, cred, p);
+    INIT_IN(&inp->ih, CODA_IOCTL, cred, l->l_proc);
     inp->VFid = *fid;
 
     /* command was mutated by increasing its size field to reflect the  
@@ -302,14 +302,14 @@
 
 int
 venus_getattr(void *mdp, ViceFid *fid,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	struct vattr *vap)
 {
     DECL(coda_getattr);			/* sets Isize & Osize */
     ALLOC(coda_getattr);			/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_GETATTR, cred, p);
+    INIT_IN(&inp->ih, CODA_GETATTR, cred, l->l_proc);
     inp->VFid = *fid;
 
     error = coda_call(mdp, Isize, &Osize, (char *)inp);
@@ -323,13 +323,13 @@
 
 int
 venus_setattr(void *mdp, ViceFid *fid, struct vattr *vap,
-	struct ucred *cred, struct proc *p)
+	struct ucred *cred, struct lwp *l)
 {
     DECL_NO_OUT(coda_setattr);		/* sets Isize & Osize */
     ALLOC_NO_OUT(coda_setattr);		/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_SETATTR, cred, p);
+    INIT_IN(&inp->ih, CODA_SETATTR, cred, l->l_proc);
     inp->VFid = *fid;
     CNV_V2VV_ATTR(&inp->attr, vap);
 
@@ -341,13 +341,13 @@
 
 int
 venus_access(void *mdp, ViceFid *fid, int mode,
-	struct ucred *cred, struct proc *p)
+	struct ucred *cred, struct lwp *l)
 {
     DECL_NO_OUT(coda_access);		/* sets Isize & Osize */
     ALLOC_NO_OUT(coda_access);		/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_ACCESS, cred, p);
+    INIT_IN(&inp->ih, CODA_ACCESS, cred, l->l_proc);
     inp->VFid = *fid;
     inp->flags = mode;
 
@@ -359,7 +359,7 @@
 
 int
 venus_readlink(void *mdp, ViceFid *fid,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	char **str, int *len)
 {
     DECL(coda_readlink);			/* sets Isize & Osize */
@@ -367,7 +367,7 @@
     ALLOC(coda_readlink);		/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_READLINK, cred, p);
+    INIT_IN(&inp->ih, CODA_READLINK, cred, l->l_proc);
     inp->VFid = *fid;
 
     Osize += CODA_MAXPATHLEN;
@@ -384,13 +384,13 @@
 
 int
 venus_fsync(void *mdp, ViceFid *fid,
-	struct ucred *cred, struct proc *p)
+	struct ucred *cred, struct lwp *l)
 {
     DECL_NO_OUT(coda_fsync);		/* sets Isize & Osize */
     ALLOC_NO_OUT(coda_fsync);		/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_FSYNC, cred, p);
+    INIT_IN(&inp->ih, CODA_FSYNC, cred, l->l_proc);
     inp->VFid = *fid;
 
     error = coda_call(mdp, Isize, &Osize, (char *)inp);
@@ -402,7 +402,7 @@
 int
 venus_lookup(void *mdp, ViceFid *fid,
     	const char *nm, int len,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	ViceFid *VFid, int *vtype)
 {
     DECL(coda_lookup);			/* sets Isize & Osize */
@@ -410,7 +410,7 @@
     ALLOC(coda_lookup);			/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_LOOKUP, cred, p);
+    INIT_IN(&inp->ih, CODA_LOOKUP, cred, l->l_proc);
     inp->VFid = *fid;
 
     /* NOTE:
@@ -439,7 +439,7 @@
 int
 venus_create(void *mdp, ViceFid *fid,
     	const char *nm, int len, int exclusive, int mode, struct vattr *va,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	ViceFid *VFid, struct vattr *attr)
 {
     DECL(coda_create);			/* sets Isize & Osize */
@@ -447,7 +447,7 @@
     ALLOC(coda_create);			/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_CREATE, cred, p);
+    INIT_IN(&inp->ih, CODA_CREATE, cred, l->l_proc);
     inp->VFid = *fid;
     inp->excl = exclusive ? C_O_EXCL : 0;
     inp->mode = mode<<6;
@@ -469,14 +469,14 @@
 int
 venus_remove(void *mdp, ViceFid *fid,
         const char *nm, int len,
-	struct ucred *cred, struct proc *p)
+	struct ucred *cred, struct lwp *l)
 {
     DECL_NO_OUT(coda_remove);		/* sets Isize & Osize */
     coda_remove_size += len + 1;
     ALLOC_NO_OUT(coda_remove);		/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_REMOVE, cred, p);
+    INIT_IN(&inp->ih, CODA_REMOVE, cred, l->l_proc);
     inp->VFid = *fid;
 
     inp->name = Isize;
@@ -491,14 +491,14 @@
 int
 venus_link(void *mdp, ViceFid *fid, ViceFid *tfid,
         const char *nm, int len,
-	struct ucred *cred, struct proc *p)
+	struct ucred *cred, struct lwp *l)
 {
     DECL_NO_OUT(coda_link);		/* sets Isize & Osize */
     coda_link_size += len + 1;
     ALLOC_NO_OUT(coda_link);		/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_LINK, cred, p);
+    INIT_IN(&inp->ih, CODA_LINK, cred, l->l_proc);
     inp->sourceFid = *fid;
     inp->destFid = *tfid;
 
@@ -514,14 +514,14 @@
 int
 venus_rename(void *mdp, ViceFid *fid, ViceFid *tfid,
         const char *nm, int len, const char *tnm, int tlen,
-	struct ucred *cred, struct proc *p)
+	struct ucred *cred, struct lwp *l)
 {
     DECL_NO_OUT(coda_rename);		/* sets Isize & Osize */
     coda_rename_size += len + 1 + tlen + 1;
     ALLOC_NO_OUT(coda_rename);		/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_RENAME, cred, p);
+    INIT_IN(&inp->ih, CODA_RENAME, cred, l->l_proc);
     inp->sourceFid = *fid;
     inp->destFid = *tfid;
 
@@ -540,7 +540,7 @@
 int
 venus_mkdir(void *mdp, ViceFid *fid,
     	const char *nm, int len, struct vattr *va,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	ViceFid *VFid, struct vattr *ova)
 {
     DECL(coda_mkdir);			/* sets Isize & Osize */
@@ -548,7 +548,7 @@
     ALLOC(coda_mkdir);			/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_MKDIR, cred, p);
+    INIT_IN(&inp->ih, CODA_MKDIR, cred, l->l_proc);
     inp->VFid = *fid;
     CNV_V2VV_ATTR(&inp->attr, va);
 
@@ -568,14 +568,14 @@
 int
 venus_rmdir(void *mdp, ViceFid *fid,
     	const char *nm, int len,
-	struct ucred *cred, struct proc *p)
+	struct ucred *cred, struct lwp *l)
 {
     DECL_NO_OUT(coda_rmdir);		/* sets Isize & Osize */
     coda_rmdir_size += len + 1;
     ALLOC_NO_OUT(coda_rmdir);		/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_RMDIR, cred, p);
+    INIT_IN(&inp->ih, CODA_RMDIR, cred, l->l_proc);
     inp->VFid = *fid;
 
     inp->name = Isize;
@@ -590,14 +590,14 @@
 int
 venus_symlink(void *mdp, ViceFid *fid,
         const char *lnm, int llen, const char *nm, int len, struct vattr *va,
-	struct ucred *cred, struct proc *p)
+	struct ucred *cred, struct lwp *l)
 {
     DECL_NO_OUT(coda_symlink);		/* sets Isize & Osize */
     coda_symlink_size += llen + 1 + len + 1;
     ALLOC_NO_OUT(coda_symlink);		/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_SYMLINK, cred, p);
+    INIT_IN(&inp->ih, CODA_SYMLINK, cred, l->l_proc);
     inp->VFid = *fid;
     CNV_V2VV_ATTR(&inp->attr, va);
 
@@ -616,7 +616,7 @@
 int
 venus_readdir(void *mdp, ViceFid *fid,
     	int count, int offset,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	char *buffer, int *len)
 {
     DECL(coda_readdir);			/* sets Isize & Osize */
@@ -624,7 +624,7 @@
     ALLOC(coda_readdir);			/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_READDIR, cred, p);
+    INIT_IN(&inp->ih, CODA_READDIR, cred, l->l_proc);
     inp->VFid = *fid;
     inp->count = count;
     inp->offset = offset;
@@ -641,14 +641,14 @@
 }
 
 int
-venus_statfs(void *mdp, struct ucred *cred, struct proc *p,
+venus_statfs(void *mdp, struct ucred *cred, struct lwp *l,
    /*out*/   struct coda_statfs *fsp)
 {
     DECL(coda_statfs);			/* sets Isize & Osize */
     ALLOC(coda_statfs);			/* sets inp & outp */
 
     /* send the open to venus. */
-    INIT_IN(&inp->ih, CODA_STATFS, cred, p);
+    INIT_IN(&inp->ih, CODA_STATFS, cred, l->l_proc);
 
     error = coda_call(mdp, Isize, &Osize, (char *)inp);
     if (!error) {
@@ -661,14 +661,14 @@
 
 int
 venus_fhtovp(void *mdp, ViceFid *fid,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	ViceFid *VFid, int *vtype)
 {
     DECL(coda_vget);			/* sets Isize & Osize */
     ALLOC(coda_vget);			/* sets inp & outp */
 
     /* Send the open to Venus. */
-    INIT_IN(&inp->ih, CODA_VGET, cred, p);
+    INIT_IN(&inp->ih, CODA_VGET, cred, l->l_proc);
     inp->VFid = *fid;
 
     error = coda_call(mdp, Isize, &Osize, (char *)inp);
--- a/sys/coda/coda_venus.h	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/coda/coda_venus.h	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_venus.h,v 1.4 2002/03/27 05:10:40 phil Exp $	*/
+/*	$NetBSD: coda_venus.h,v 1.5 2003/06/28 14:21:15 darrenr Exp $	*/
 
 /*
  * 
@@ -33,17 +33,17 @@
 
 int
 venus_root(void *mdp,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	ViceFid *VFid);
 
 int
 venus_open(void *mdp, ViceFid *fid, int flag,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	dev_t *dev, ino_t *inode);
 
 int
 venus_close(void *mdp, ViceFid *fid, int flag,
-	struct ucred *cred, struct proc *p);
+	struct ucred *cred, struct lwp *l);
 
 void
 venus_read(void);
@@ -54,84 +54,84 @@
 int
 venus_ioctl(void *mdp, ViceFid *fid,
 	int com, int flag, caddr_t data,
-	struct ucred *cred, struct proc *p);
+	struct ucred *cred, struct lwp *l);
 
 int
 venus_getattr(void *mdp, ViceFid *fid,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	struct vattr *vap);
 
 int
 venus_setattr(void *mdp, ViceFid *fid, struct vattr *vap,
-	struct ucred *cred, struct proc *p);
+	struct ucred *cred, struct lwp *l);
 
 int
 venus_access(void *mdp, ViceFid *fid, int mode,
-	struct ucred *cred, struct proc *p);
+	struct ucred *cred, struct lwp *l);
 
 int
 venus_readlink(void *mdp, ViceFid *fid,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	char **str, int *len);
 
 int
 venus_fsync(void *mdp, ViceFid *fid,
-	struct ucred *cred, struct proc *p);
+	struct ucred *cred, struct lwp *l);
 
 int
 venus_lookup(void *mdp, ViceFid *fid,
     	const char *nm, int len,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	ViceFid *VFid, int *vtype);
 
 int
 venus_create(void *mdp, ViceFid *fid,
     	const char *nm, int len, int exclusive, int mode, struct vattr *va,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	ViceFid *VFid, struct vattr *attr);
 
 int
 venus_remove(void *mdp, ViceFid *fid,
         const char *nm, int len,
-	struct ucred *cred, struct proc *p);
+	struct ucred *cred, struct lwp *l);
 
 int
 venus_link(void *mdp, ViceFid *fid, ViceFid *tfid,
         const char *nm, int len,
-	struct ucred *cred, struct proc *p);
+	struct ucred *cred, struct lwp *l);
 
 int
 venus_rename(void *mdp, ViceFid *fid, ViceFid *tfid,
         const char *nm, int len, const char *tnm, int tlen,
-	struct ucred *cred, struct proc *p);
+	struct ucred *cred, struct lwp *l);
 
 int
 venus_mkdir(void *mdp, ViceFid *fid,
     	const char *nm, int len, struct vattr *va,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	ViceFid *VFid, struct vattr *ova);
 
 int
 venus_rmdir(void *mdp, ViceFid *fid,
     	const char *nm, int len,
-	struct ucred *cred, struct proc *p);
+	struct ucred *cred, struct lwp *l);
 
 int
 venus_symlink(void *mdp, ViceFid *fid,
         const char *lnm, int llen, const char *nm, int len, struct vattr *va,
-	struct ucred *cred, struct proc *p);
+	struct ucred *cred, struct lwp *l);
 
 int
 venus_readdir(void *mdp, ViceFid *fid,
     	int count, int offset,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	char *buffer, int *len);
 
 int
-venus_statfs(void *mdp, struct ucred *cred, struct proc *p,
+venus_statfs(void *mdp, struct ucred *cred, struct lwp *l,
    /*out*/   struct coda_statfs *fsp);
 
 int
 venus_fhtovp(void *mdp, ViceFid *fid,
-	struct ucred *cred, struct proc *p,
+	struct ucred *cred, struct lwp *l,
 /*out*/	ViceFid *VFid, int *vtype);
--- a/sys/coda/coda_vfsops.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/coda/coda_vfsops.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.c,v 1.22 2003/04/16 21:44:18 christos Exp $	*/
+/*	$NetBSD: coda_vfsops.c,v 1.23 2003/06/28 14:21:15 darrenr Exp $	*/
 
 /*
  * 
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.22 2003/04/16 21:44:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.23 2003/06/28 14:21:15 darrenr Exp $");
 
 #ifdef	_LKM
 #define	NVCODA 4
@@ -108,7 +108,7 @@
     coda_nb_statfs,
     coda_sync,
     coda_vget,
-    (int (*) (struct mount *, struct fid *, struct vnode ** ))
+    (int (*) (struct mount *, struct fid *, struct vnode **, struct lwp *))
 	eopnotsupp,
     (int (*) (struct vnode *, struct fid *)) eopnotsupp,
     coda_init,
@@ -144,12 +144,12 @@
  */
 /*ARGSUSED*/
 int
-coda_mount(vfsp, path, data, ndp, p)
+coda_mount(vfsp, path, data, ndp, l)
     struct mount *vfsp;		/* Allocated and initialized by mount(2) */
     const char *path;		/* path covered: ignored by the fs-layer */
     void *data;			/* Need to define a data type for this in netbsd? */
     struct nameidata *ndp;	/* Clobber this to lookup the device name */
-    struct proc *p;		/* The ever-famous proc pointer */
+    struct lwp *l;		/* The ever-famous lwp pointer */
 {
     struct vnode *dvp;
     struct cnode *cp;
@@ -176,7 +176,7 @@
     
     /* Validate mount device.  Similar to getmdev(). */
 
-    NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, data, p);
+    NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, data, l);
     error = namei(ndp);
     dvp = ndp->ni_vp;
 
@@ -272,20 +272,20 @@
 }
 
 int
-coda_start(vfsp, flags, p)
+coda_start(vfsp, flags, l)
     struct mount *vfsp;
     int flags;
-    struct proc *p;
+    struct lwp *l;
 {
     ENTRY;
     return (0);
 }
 
 int
-coda_unmount(vfsp, mntflags, p)
+coda_unmount(vfsp, mntflags, l)
     struct mount *vfsp;
     int mntflags;
-    struct proc *p;
+    struct lwp *l;
 {
     struct coda_mntinfo *mi = vftomi(vfsp);
     int active, error = 0;
@@ -335,16 +335,18 @@
  * find root of cfs
  */
 int
-coda_root(vfsp, vpp)
+coda_root(vfsp, vpp, l)
 	struct mount *vfsp;
 	struct vnode **vpp;
+	struct lwp *l;
 {
     struct coda_mntinfo *mi = vftomi(vfsp);
     struct vnode **result;
     int error;
-    struct proc *p = curproc;    /* XXX - bnoble */
+    struct proc *p;
     ViceFid VFid;
 
+    p = l->l_proc;
     ENTRY;
     MARK_ENTRY(CODA_ROOT_STATS);
     result = NULL;
@@ -363,7 +365,7 @@
 	    }
     }
 
-    error = venus_root(vftomi(vfsp), p->p_cred->pc_ucred, p, &VFid);
+    error = venus_root(vftomi(vfsp), p->p_cred->pc_ucred, l, &VFid);
 
     if (!error) {
 	/*
@@ -406,12 +408,12 @@
 }
 
 int
-coda_quotactl(vfsp, cmd, uid, arg, p)
+coda_quotactl(vfsp, cmd, uid, arg, l)
     struct mount *vfsp;
     int cmd;
     uid_t uid;
     caddr_t arg;
-    struct proc *p;
+    struct lwp *l;
 {
     ENTRY;
     return (EOPNOTSUPP);
@@ -421,12 +423,13 @@
  * Get file system statistics.
  */
 int
-coda_nb_statfs(vfsp, sbp, p)
+coda_nb_statfs(vfsp, sbp, l)
     struct mount *vfsp;
     struct statfs *sbp;
-    struct proc *p;
+    struct lwp *l;
 {
     struct coda_statfs fsstat;
+    struct proc *p = l->l_proc;
     int error;
 
     ENTRY;
@@ -443,7 +446,7 @@
      */
     /* Note: Normal fs's have a bsize of 0x400 == 1024 */
 
-    error = venus_statfs(vftomi(vfsp), p->p_cred->pc_ucred, p, &fsstat);
+    error = venus_statfs(vftomi(vfsp), p->p_cred->pc_ucred, l, &fsstat);
 
     if (!error) {
 	sbp->f_type = 0;
@@ -465,11 +468,11 @@
  * Flush any pending I/O.
  */
 int
-coda_sync(vfsp, waitfor, cred, p)
+coda_sync(vfsp, waitfor, cred, l)
     struct mount *vfsp;
     int    waitfor;
     struct ucred *cred;
-    struct proc *p;
+    struct lwp *l;
 {
     ENTRY;
     MARK_ENTRY(CODA_SYNC_STATS);
@@ -478,10 +481,11 @@
 }
 
 int
-coda_vget(vfsp, ino, vpp)
+coda_vget(vfsp, ino, vpp, l)
     struct mount *vfsp;
     ino_t ino;
     struct vnode **vpp;
+    struct lwp *l;
 {
     ENTRY;
     return (EOPNOTSUPP);
@@ -493,21 +497,23 @@
  * a type-specific fid.  
  */
 int
-coda_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp)
+coda_fhtovp(vfsp, fhp, nam, vpp, exflagsp, creadanonp, l)
     struct mount *vfsp;    
     struct fid *fhp;
     struct mbuf *nam;
     struct vnode **vpp;
     int *exflagsp;
     struct ucred **creadanonp;
+    struct lwp *l;
 {
     struct cfid *cfid = (struct cfid *)fhp;
     struct cnode *cp = 0;
     int error;
-    struct proc *p = curproc; /* XXX -mach */
+    struct proc *p;
     ViceFid VFid;
     int vtype;
 
+    p = l->l_proc;
     ENTRY;
     
     MARK_ENTRY(CODA_VGET_STATS);
@@ -519,7 +525,7 @@
 	return(0);
     }
     
-    error = venus_fhtovp(vftomi(vfsp), &cfid->cfid_fid, p->p_cred->pc_ucred, p, &VFid, &vtype);
+    error = venus_fhtovp(vftomi(vfsp), &cfid->cfid_fid, p->p_cred->pc_ucred, l, &VFid, &vtype);
     
     if (error) {
 	CODADEBUG(CODA_VGET, myprintf(("vget error %d\n",error));)
@@ -557,14 +563,14 @@
 }
 
 int
-coda_sysctl(name, namelen, oldp, oldlp, newp, newl, p)
+coda_sysctl(name, namelen, oldp, oldlp, newp, newl, l)
 	int *name;
 	u_int namelen;
 	void *oldp;
 	size_t *oldlp;
 	void *newp;
 	size_t newl;
-	struct proc *p;
+	struct lwp *l;
 {
 
 	/* all sysctl names at this level are terminal */
@@ -608,7 +614,7 @@
 	return ENODEV;
     
     return coda_fhtovp(mi->mi_vfsp, (struct fid*)&cfid, NULL, vpp,
-		      NULL, NULL);
+		      NULL, NULL, curlwp);	/* XXX */
 }
 
 #include <ufs/ufs/quota.h>
--- a/sys/coda/coda_vfsops.h	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/coda/coda_vfsops.h	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vfsops.h,v 1.5 2000/03/16 18:08:21 jdolecek Exp $	*/
+/*	$NetBSD: coda_vfsops.h,v 1.6 2003/06/28 14:21:15 darrenr Exp $	*/
 
 /*
  * 
@@ -47,19 +47,19 @@
 
 int coda_vfsopstats_init(void);
 int coda_mount(struct mount *, const char *, void *, struct nameidata *, 
-		       struct proc *);
-int coda_start(struct mount *, int, struct proc *);
-int coda_unmount(struct mount *, int, struct proc *);
-int coda_root(struct mount *, struct vnode **);
-int coda_quotactl(struct mount *, int, uid_t, caddr_t, struct proc *);
-int coda_nb_statfs(struct mount *, struct statfs *, struct proc *);
-int coda_sync(struct mount *, int, struct ucred *, struct proc *);
-int coda_vget(struct mount *, ino_t, struct vnode **);
+		       struct lwp *);
+int coda_start(struct mount *, int, struct lwp *);
+int coda_unmount(struct mount *, int, struct lwp *);
+int coda_root(struct mount *, struct vnode **, struct lwp *);
+int coda_quotactl(struct mount *, int, uid_t, caddr_t, struct lwp *);
+int coda_nb_statfs(struct mount *, struct statfs *, struct lwp *);
+int coda_sync(struct mount *, int, struct ucred *, struct lwp *);
+int coda_vget(struct mount *, ino_t, struct vnode **, struct lwp *);
 int coda_fhtovp(struct mount *, struct fid *, struct mbuf *, struct vnode **,
-		       int *, struct ucred **);
+		       int *, struct ucred **, struct lwp *);
 int coda_vptofh(struct vnode *, struct fid *);
 void coda_init(void);
 void coda_done(void);
 int coda_sysctl(int *, u_int, void *, size_t *, void *, size_t,
-		    struct proc *);
+		    struct lwp *);
 int getNewVnode(struct vnode **vpp);
--- a/sys/coda/coda_vnops.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/coda/coda_vnops.c	Sat Jun 28 14:20:43 2003 +0000
@@ -6,7 +6,7 @@
 rmdir
 symlink
 */
-/*	$NetBSD: coda_vnops.c,v 1.33 2003/01/06 20:32:42 wiz Exp $	*/
+/*	$NetBSD: coda_vnops.c,v 1.34 2003/06/28 14:21:15 darrenr Exp $	*/
 
 /*
  * 
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.33 2003/01/06 20:32:42 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.34 2003/06/28 14:21:15 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -231,7 +231,7 @@
     struct cnode *cp = VTOC(*vpp);
     int flag = ap->a_mode & (~O_EXCL);
     struct ucred *cred = ap->a_cred;
-    struct proc *p = ap->a_p;
+    struct lwp *l = ap->a_l;
 /* locals */
     int error;
     struct vnode *vp;
@@ -252,7 +252,7 @@
 	return(0);
     }
 
-    error = venus_open(vtomi((*vpp)), &cp->c_fid, flag, cred, p, &dev, &inode);
+    error = venus_open(vtomi((*vpp)), &cp->c_fid, flag, cred, l, &dev, &inode);
     if (error)
 	return (error);
     if (!error) {
@@ -262,7 +262,7 @@
 
     /* Translate the <device, inode> pair for the cache file into
        an inode pointer. */
-    error = coda_grab_vnode(dev, inode, &vp);
+    error = coda_grab_vnode(dev, inode, &vp, l);
     if (error)
 	return (error);
 
@@ -292,7 +292,7 @@
     cp->c_inode = inode;
 
     /* Open the cache file. */
-    error = VOP_OPEN(vp, flag, cred, p); 
+    error = VOP_OPEN(vp, flag, cred, l); 
     return(error);
 }
 
@@ -309,7 +309,7 @@
     struct cnode *cp = VTOC(vp);
     int flag = ap->a_fflag;
     struct ucred *cred = ap->a_cred;
-    struct proc *p = ap->a_p;
+    struct lwp *l = ap->a_l;
 /* locals */
     int error;
 
@@ -331,7 +331,7 @@
 	    vgone(cp->c_ovp);
 #else
 	    vn_lock(cp->c_ovp, LK_EXCLUSIVE | LK_RETRY);
-	    VOP_CLOSE(cp->c_ovp, flag, cred, p); /* Do errors matter here? */
+	    VOP_CLOSE(cp->c_ovp, flag, cred, l); /* Do errors matter here? */
 	    vput(cp->c_ovp);
 #endif
 	} else {
@@ -342,7 +342,7 @@
 	return ENODEV;
     } else {
 	vn_lock(cp->c_ovp, LK_EXCLUSIVE | LK_RETRY);
-	VOP_CLOSE(cp->c_ovp, flag, cred, p); /* Do errors matter here? */
+	VOP_CLOSE(cp->c_ovp, flag, cred, l); /* Do errors matter here? */
 	vput(cp->c_ovp);
     }
 
@@ -352,7 +352,7 @@
     if (flag & FWRITE)                    /* file was opened for write */
 	--cp->c_owrite;
 
-    error = venus_close(vtomi(vp), &cp->c_fid, flag, cred, p);
+    error = venus_close(vtomi(vp), &cp->c_fid, flag, cred, l);
     vrele(CTOV(cp));
 
     CODADEBUG(CODA_CLOSE, myprintf(("close: result %d\n",error)); )
@@ -367,7 +367,7 @@
 
     ENTRY;
     return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_READ,
-		    ap->a_ioflag, ap->a_cred, ap->a_uio->uio_procp));
+		    ap->a_ioflag, ap->a_cred, ap->a_uio->uio_lwp));
 }
 
 int
@@ -378,23 +378,24 @@
 
     ENTRY;
     return(coda_rdwr(ap->a_vp, ap->a_uio, UIO_WRITE,
-		    ap->a_ioflag, ap->a_cred, ap->a_uio->uio_procp));
+		    ap->a_ioflag, ap->a_cred, ap->a_uio->uio_lwp));
 }
 
 int
-coda_rdwr(vp, uiop, rw, ioflag, cred, p)
+coda_rdwr(vp, uiop, rw, ioflag, cred, l)
     struct vnode *vp;
     struct uio *uiop;
     enum uio_rw rw;
     int ioflag;
     struct ucred *cred;
-    struct proc *p;
+    struct lwp *l;
 { 
 /* upcall decl */
   /* NOTE: container file operation!!! */
 /* locals */
     struct cnode *cp = VTOC(vp);
     struct vnode *cfvp = cp->c_ovp;
+    struct proc *p = l->l_proc;
     int igot_internally = 0;
     int opened_internally = 0;
     int error = 0;
@@ -429,7 +430,7 @@
 	 */
 	if (cp->c_inode != 0 && !(p && (p->p_acflag & ACORE))) { 
 	    igot_internally = 1;
-	    error = coda_grab_vnode(cp->c_device, cp->c_inode, &cfvp);
+	    error = coda_grab_vnode(cp->c_device, cp->c_inode, &cfvp, l);
 	    if (error) {
 		MARK_INT_FAIL(CODA_RDWR_STATS);
 		return(error);
@@ -444,7 +445,7 @@
 	    opened_internally = 1;
 	    MARK_INT_GEN(CODA_OPEN_STATS);
 	    error = VOP_OPEN(vp, (rw == UIO_READ ? FREAD : FWRITE), 
-			     cred, p);
+			     cred, l);
 #ifdef	CODA_VERBOSE
 printf("coda_rdwr: Internally Opening %p\n", vp);
 #endif
@@ -475,7 +476,7 @@
     /* Do an internal close if necessary. */
     if (opened_internally) {
 	MARK_INT_GEN(CODA_CLOSE_STATS);
-	(void)VOP_CLOSE(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, p);
+	(void)VOP_CLOSE(vp, (rw == UIO_READ ? FREAD : FWRITE), cred, l);
     }
 
     /* Invalidate cached attributes if writing. */
@@ -495,7 +496,7 @@
     caddr_t data = ap->a_data;
     int flag = ap->a_fflag;
     struct ucred *cred = ap->a_cred;
-    struct proc  *p = ap->a_p;
+    struct lwp  *l = ap->a_l;
 /* locals */
     int error;
     struct vnode *tvp;
@@ -520,7 +521,8 @@
     /* Should we use the name cache here? It would get it from
        lookupname sooner or later anyway, right? */
 
-    NDINIT(&ndp, LOOKUP, (iap->follow ? FOLLOW : NOFOLLOW), UIO_USERSPACE, ((caddr_t)iap->path), p);
+    NDINIT(&ndp, LOOKUP, (iap->follow ? FOLLOW : NOFOLLOW), UIO_USERSPACE,
+	   ((caddr_t)iap->path), l);
     error = namei(&ndp);
     tvp = ndp.ni_vp;
 
@@ -549,7 +551,7 @@
 	vrele(tvp);
 	return(EINVAL);
     }
-    error = venus_ioctl(vtomi(tvp), &((VTOC(tvp))->c_fid), com, flag, data, cred, p);
+    error = venus_ioctl(vtomi(tvp), &((VTOC(tvp))->c_fid), com, flag, data, cred, l);
 
     if (error)
 	MARK_INT_FAIL(CODA_IOCTL_STATS);
@@ -579,7 +581,7 @@
     struct cnode *cp = VTOC(vp);
     struct vattr *vap = ap->a_vap;
     struct ucred *cred = ap->a_cred;
-    struct proc *p = ap->a_p;
+    struct lwp *l = ap->a_l;
 /* locals */
     int error;
 
@@ -605,7 +607,7 @@
 	return(0);
     }
 
-    error = venus_getattr(vtomi(vp), &cp->c_fid, cred, p, vap);
+    error = venus_getattr(vtomi(vp), &cp->c_fid, cred, l, vap);
 
     if (!error) {
 	CODADEBUG(CODA_GETATTR, myprintf(("getattr miss (%lx.%lx.%lx): result %d\n",
@@ -637,7 +639,7 @@
     struct cnode *cp = VTOC(vp);
     struct vattr *vap = ap->a_vap;
     struct ucred *cred = ap->a_cred;
-    struct proc *p = ap->a_p;
+    struct lwp *l = ap->a_l;
 /* locals */
     int error;
 
@@ -652,7 +654,7 @@
     if (codadebug & CODADBGMSK(CODA_SETATTR)) {
 	print_vattr(vap);
     }
-    error = venus_setattr(vtomi(vp), &cp->c_fid, vap, cred, p);
+    error = venus_setattr(vtomi(vp), &cp->c_fid, vap, cred, l);
 
     if (!error)
 	cp->c_flags &= ~C_VATTR;
@@ -671,7 +673,7 @@
     struct cnode *cp = VTOC(vp);
     int mode = ap->a_mode;
     struct ucred *cred = ap->a_cred;
-    struct proc *p = ap->a_p;
+    struct lwp *l = ap->a_l;
 /* locals */
     int error;
 
@@ -700,7 +702,7 @@
 	}
     }
 
-    error = venus_access(vtomi(vp), &cp->c_fid, mode, cred, p);
+    error = venus_access(vtomi(vp), &cp->c_fid, mode, cred, l);
 
     return(error);
 }
@@ -738,7 +740,7 @@
     struct cnode *cp = VTOC(vp);
     struct uio *uiop = ap->a_uio;
     struct ucred *cred = ap->a_cred;
-    struct proc *p = ap->a_uio->uio_procp;
+    struct lwp *l = ap->a_uio->uio_lwp;
 /* locals */
     int error;
     char *str;
@@ -762,7 +764,7 @@
 	return(error);
     }
 
-    error = venus_readlink(vtomi(vp), &cp->c_fid, cred, p, &str, &len);
+    error = venus_readlink(vtomi(vp), &cp->c_fid, cred, l, &str, &len);
 
     if (!error) {
 	uiop->uio_rw = UIO_READ;
@@ -789,7 +791,7 @@
     struct vnode *vp = ap->a_vp;
     struct cnode *cp = VTOC(vp);
     struct ucred *cred = ap->a_cred;
-    struct proc *p = ap->a_p;
+    struct lwp *l = ap->a_l;
 /* locals */
     struct vnode *convp = cp->c_ovp;
     int error;
@@ -812,7 +814,7 @@
     }
 
     if (convp)
-    	VOP_FSYNC(convp, cred, MNT_WAIT, 0, 0, p);
+    	VOP_FSYNC(convp, cred, MNT_WAIT, 0, 0, l);
 
     /*
      * We can expect fsync on any vnode at all if venus is pruging it.
@@ -825,7 +827,7 @@
 	return(0);
     }
 
-    error = venus_fsync(vtomi(vp), &cp->c_fid, cred, p);
+    error = venus_fsync(vtomi(vp), &cp->c_fid, cred, l);
 
     CODADEBUG(CODA_FSYNC, myprintf(("in fsync result %d\n",error)); );
     return(error);
@@ -842,7 +844,7 @@
     struct vnode *vp = ap->a_vp;
     struct cnode *cp = VTOC(vp);
     struct ucred *cred __attribute__((unused)) = NULL;
-    struct proc *p __attribute__((unused)) = curproc;
+    struct lwp *l __attribute__((unused)) = curlwp;
 /* upcall decl */
 /* locals */
 
@@ -924,7 +926,7 @@
      */
     struct componentname  *cnp = ap->a_cnp;
     struct ucred *cred = cnp->cn_cred;
-    struct proc *p = cnp->cn_proc;
+    struct lwp *l = cnp->cn_lwp;
 /* locals */
     struct cnode *cp;
     const char *nm = cnp->cn_nameptr;
@@ -969,7 +971,7 @@
     } else {
 	
 	/* The name wasn't cached, so we need to contact Venus */
-	error = venus_lookup(vtomi(dvp), &dcp->c_fid, nm, len, cred, p, &VFid, &vtype);
+	error = venus_lookup(vtomi(dvp), &dcp->c_fid, nm, len, cred, l, &VFid, &vtype);
 	
 	if (error) {
 	    MARK_INT_FAIL(CODA_LOOKUP_STATS);
@@ -1087,7 +1089,7 @@
     struct vnode **vpp = ap->a_vpp;
     struct componentname  *cnp = ap->a_cnp;
     struct ucred *cred = cnp->cn_cred;
-    struct proc *p = cnp->cn_proc;
+    struct lwp *l = cnp->cn_lwp;
 /* locals */
     int error;
     struct cnode *cp;
@@ -1108,7 +1110,7 @@
 	return(EACCES);
     }
 
-    error = venus_create(vtomi(dvp), &dcp->c_fid, nm, len, exclusive, mode, va, cred, p, &VFid, &attr);
+    error = venus_create(vtomi(dvp), &dcp->c_fid, nm, len, exclusive, mode, va, cred, l, &VFid, &attr);
 
     if (!error) {
 	
@@ -1188,7 +1190,7 @@
     struct cnode *cp = VTOC(dvp);
     struct componentname  *cnp = ap->a_cnp;
     struct ucred *cred = cnp->cn_cred;
-    struct proc *p = cnp->cn_proc;
+    struct lwp *l = cnp->cn_lwp;
 /* locals */
     int error;
     const char *nm = cnp->cn_nameptr;
@@ -1231,7 +1233,7 @@
 	return(ENOENT);
     }
 
-    error = venus_remove(vtomi(dvp), &cp->c_fid, nm, len, cred, p);
+    error = venus_remove(vtomi(dvp), &cp->c_fid, nm, len, cred, l);
 
     CODADEBUG(CODA_REMOVE, myprintf(("in remove result %d\n",error)); )
 
@@ -1265,7 +1267,7 @@
     struct cnode *tdcp = VTOC(tdvp);
     struct componentname *cnp = ap->a_cnp;
     struct ucred *cred = cnp->cn_cred;
-    struct proc *p = cnp->cn_proc;
+    struct lwp *l = cnp->cn_lwp;
 /* locals */
     int error;
     const char *nm = cnp->cn_nameptr;
@@ -1310,7 +1312,7 @@
 	goto exit;
     }
 	
-    error = venus_link(vtomi(vp), &cp->c_fid, &tdcp->c_fid, nm, len, cred, p);
+    error = venus_link(vtomi(vp), &cp->c_fid, &tdcp->c_fid, nm, len, cred, l);
 
     /* Invalidate the parent's attr cache, the modification time has changed */
     VTOC(tdvp)->c_flags &= ~C_VATTR;
@@ -1345,7 +1347,7 @@
     struct cnode *ndcp = VTOC(ndvp);
     struct componentname  *tcnp = ap->a_tcnp;
     struct ucred *cred = fcnp->cn_cred;
-    struct proc *p = fcnp->cn_proc;
+    struct lwp *l = fcnp->cn_lwp;
 /* true args */
     int error;
     const char *fnm = fcnp->cn_nameptr;
@@ -1359,7 +1361,7 @@
        This could be Bad. XXX */
 #ifdef OLD_DIAGNOSTIC
     if ((fcnp->cn_cred != tcnp->cn_cred)
-	|| (fcnp->cn_proc != tcnp->cn_proc))
+	|| (fcnp->cn_lwp != tcnp->cn_lwp))
     {
 	panic("coda_rename: component names don't agree");
     }
@@ -1402,7 +1404,7 @@
 	goto exit;
     }
 
-    error = venus_rename(vtomi(odvp), &odcp->c_fid, &ndcp->c_fid, fnm, flen, tnm, tlen, cred, p);
+    error = venus_rename(vtomi(odvp), &odcp->c_fid, &ndcp->c_fid, fnm, flen, tnm, tlen, cred, l);
 
  exit:
     CODADEBUG(CODA_RENAME, myprintf(("in rename result %d\n",error));)
@@ -1439,7 +1441,7 @@
     struct vattr *va = ap->a_vap;
     struct vnode **vpp = ap->a_vpp;
     struct ucred *cred = cnp->cn_cred;
-    struct proc *p = cnp->cn_proc;
+    struct lwp *l = cnp->cn_lwp;
 /* locals */
     int error;
     const char *nm = cnp->cn_nameptr;
@@ -1463,7 +1465,7 @@
 	return(EACCES);
     }
 
-    error = venus_mkdir(vtomi(dvp), &dcp->c_fid, nm, len, va, cred, p, &VFid, &ova);
+    error = venus_mkdir(vtomi(dvp), &dcp->c_fid, nm, len, va, cred, l, &VFid, &ova);
 
     if (!error) {
 	if (coda_find(&VFid) != NULL)
@@ -1529,7 +1531,7 @@
     struct cnode *dcp = VTOC(dvp);
     struct componentname  *cnp = ap->a_cnp;
     struct ucred *cred = cnp->cn_cred;
-    struct proc *p = cnp->cn_proc;
+    struct lwp *l = cnp->cn_lwp;
 /* true args */
     int error;
     const char *nm = cnp->cn_nameptr;
@@ -1561,7 +1563,7 @@
     /* Invalidate the parent's attr cache, the modification time has changed */
     dcp->c_flags &= ~C_VATTR;
 
-    error = venus_rmdir(vtomi(dvp), &dcp->c_fid, nm, len, cred, p);
+    error = venus_rmdir(vtomi(dvp), &dcp->c_fid, nm, len, cred, l);
 
     CODADEBUG(CODA_RMDIR, myprintf(("in rmdir result %d\n", error)); )
 
@@ -1594,7 +1596,7 @@
     struct vattr *tva = ap->a_vap;
     char *path = ap->a_target;
     struct ucred *cred = cnp->cn_cred;
-    struct proc *p = cnp->cn_proc;
+    struct lwp *l = cnp->cn_lwp;
 /* locals */
     int error;
     /* 
@@ -1637,7 +1639,7 @@
 	goto exit;
     }
 
-    error = venus_symlink(vtomi(tdvp), &tdcp->c_fid, path, plen, nm, len, tva, cred, p);
+    error = venus_symlink(vtomi(tdvp), &tdcp->c_fid, path, plen, nm, len, tva, cred, l);
 
     /* Invalidate the parent's attr cache, the modification time has changed */
     tdcp->c_flags &= ~C_VATTR;
@@ -1645,7 +1647,7 @@
     if (!error)
     {
 	struct nameidata nd;
-	NDINIT(&nd, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, nm, p);
+	NDINIT(&nd, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, nm, l);
 	nd.ni_cnd.cn_cred = cred;
 	nd.ni_loopcnt = 0;
 	nd.ni_startdir = tdvp;
@@ -1685,7 +1687,7 @@
     int *eofflag = ap->a_eofflag;
     off_t **cookies = ap->a_cookies;
     int *ncookies = ap->a_ncookies;
-    struct proc *p = ap->a_uio->uio_procp;
+    struct lwp *l = ap->a_uio->uio_lwp;
 /* upcall decl */
 /* locals */
     int error = 0;
@@ -1708,7 +1710,7 @@
 	if (cp->c_ovp == NULL) {
 	    opened_internally = 1;
 	    MARK_INT_GEN(CODA_OPEN_STATS);
-	    error = VOP_OPEN(vp, FREAD, cred, p);
+	    error = VOP_OPEN(vp, FREAD, cred, l);
 #ifdef	CODA_VERBOSE
 printf("coda_readdir: Internally Opening %p\n", vp);
 #endif
@@ -1727,7 +1729,7 @@
 	/* Do an "internal close" if necessary. */ 
 	if (opened_internally) {
 	    MARK_INT_GEN(CODA_CLOSE_STATS);
-	    (void)VOP_CLOSE(vp, FREAD, cred, p);
+	    (void)VOP_CLOSE(vp, FREAD, cred, l);
 	}
     }
 
@@ -1748,7 +1750,7 @@
     daddr_t bn __attribute__((unused)) = ap->a_bn;	/* fs block number */
     struct vnode **vpp = ap->a_vpp;			/* RETURN vp of device */
     daddr_t *bnp __attribute__((unused)) = ap->a_bnp;	/* RETURN device block number */
-    struct proc *p __attribute__((unused)) = curproc;
+    struct lwp *l __attribute__((unused)) = curlwp;
 /* upcall decl */
 /* locals */
 
@@ -1771,7 +1773,7 @@
 /* true args */
     struct vop_strategy_args *ap = v;
     struct buf *bp __attribute__((unused)) = ap->a_bp;
-    struct proc *p __attribute__((unused)) = curproc;
+    struct lwp *l __attribute__((unused)) = curlwp;
 /* upcall decl */
 /* locals */
 
@@ -1871,7 +1873,7 @@
 
 /* How one looks up a vnode given a device/inode pair: */
 int
-coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp)
+coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp, struct lwp *l)
 {
     /* This is like VFS_VGET() or igetinode()! */
     int           error;
@@ -1883,7 +1885,7 @@
     }
 
     /* XXX - ensure that nonzero-return means failure */
-    error = VFS_VGET(mp,ino,vpp);
+    error = VFS_VGET(mp, ino, vpp, l);
     if (error) {
 	myprintf(("coda_grab_vnode: iget/vget(%d, %d) returns %p, err %d\n", 
 		  dev, ino, *vpp, error));
@@ -2019,8 +2021,8 @@
 	} */ *ap = v;
 	struct vnode *vp = ap->a_vp;
 	struct cnode *cp = VTOC(vp);
-	struct proc *p = curproc;
-	struct ucred *cred = p->p_ucred;
+	struct lwp *l = curlwp;
+	struct ucred *cred = l->l_proc->p_ucred;
 	int error;
 
 	/* Check for control object. */
@@ -2028,13 +2030,13 @@
 		return(EINVAL);
 	}
 
-	error = VOP_OPEN(vp, FREAD, cred, p);
+	error = VOP_OPEN(vp, FREAD, cred, l);
 	if (error) {
 		return error;
 	}
 	ap->a_vp = cp->c_ovp;
 	error = VOCALL(ap->a_vp->v_op, VOFFSET(vop_getpages), ap);
-	(void) VOP_CLOSE(vp, FREAD, cred, p);
+	(void) VOP_CLOSE(vp, FREAD, cred, l);
 	return error;
 }
 
--- a/sys/coda/coda_vnops.h	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/coda/coda_vnops.h	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: coda_vnops.h,v 1.6 2001/07/03 06:46:52 chs Exp $	*/
+/*	$NetBSD: coda_vnops.h,v 1.7 2003/06/28 14:21:15 darrenr Exp $	*/
 
 /*
  * 
@@ -81,8 +81,8 @@
 
 int (**coda_vnodeop_p)(void *);
 int coda_rdwr(struct vnode *vp, struct uio *uiop, enum uio_rw rw,
-    int ioflag, struct ucred *cred, struct proc *p);
+    int ioflag, struct ucred *cred, struct lwp *l);
 
-int coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp);
+int coda_grab_vnode(dev_t dev, ino_t ino, struct vnode **vpp, struct lwp *);
 void print_vattr(struct vattr *attr);
 void print_cred(struct ucred *cred);
--- a/sys/compat/aout/aout_misc.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/aout/aout_misc.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: aout_misc.c,v 1.11 2003/01/18 07:17:04 thorpej Exp $	*/
+/*	$NetBSD: aout_misc.c,v 1.12 2003/06/28 14:21:16 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aout_misc.c,v 1.11 2003/01/18 07:17:04 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aout_misc.c,v 1.12 2003/06/28 14:21:16 darrenr Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ktrace.h"
@@ -76,10 +76,10 @@
 
 #if 0
 	if (SCARG(uap, flags) & O_CREAT)
-		CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
+		CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
 	else 
 #endif
-		CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+		CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_open(l, v, retval);
 }
@@ -95,9 +95,9 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 #if 0
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, link));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, link));
 #endif
 
 	return sys_link(l, v, retval);
@@ -114,7 +114,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_unlink(l, v, retval);
 }
@@ -130,7 +130,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_chdir(l, v, retval);
 }
@@ -146,7 +146,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_chmod(l, v, retval);
 }
@@ -162,7 +162,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_chown(l, v, retval);
 }
@@ -178,7 +178,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_unmount(l, v, retval);
 }
@@ -194,7 +194,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_access(l, v, retval);
 }
@@ -210,7 +210,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_chflags(l, v, retval);
 }
@@ -226,7 +226,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return compat_43_sys_stat(l, v, retval);
 }
@@ -242,7 +242,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return compat_43_sys_lstat(l, v, retval);
 }
@@ -258,7 +258,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_revoke(l, v, retval);
 }
@@ -274,9 +274,9 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 #if 0
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, link));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, link));
 #endif
 
 	return sys_symlink(l, v, retval);
@@ -293,7 +293,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
+	CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
 
 	return sys_readlink(l, v, retval);
 }
@@ -309,7 +309,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_execve(l, v, retval);
 }
@@ -325,7 +325,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_chroot(l, v, retval);
 }
@@ -341,9 +341,9 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, from));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, from));
 #if 0
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, to));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, to));
 #endif
 
 	return sys_rename(l, v, retval);
@@ -360,7 +360,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return compat_43_sys_truncate(l, v, retval);
 }
@@ -376,7 +376,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_rmdir(l, v, retval);
 }
@@ -392,7 +392,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_utimes(l, v, retval);
 }
@@ -408,7 +408,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_statfs(l, v, retval);
 }
@@ -425,7 +425,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, fname));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, fname));
 
 	return sys_getfh(l, v, retval);
 }
@@ -442,7 +442,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return compat_12_sys_stat(l, v, retval);
 }
@@ -458,7 +458,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return compat_12_sys_lstat(l, v, retval);
 }
@@ -474,7 +474,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_pathconf(l, v, retval);
 }
@@ -490,7 +490,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_truncate(l, v, retval);
 }
@@ -506,7 +506,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_undelete(l, v, retval);
 }
@@ -522,9 +522,9 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, from));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, from));
 #if 0
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, to));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, to));
 #endif
 
 	return sys___posix_rename(l, v, retval);
@@ -541,7 +541,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
+	CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
 
 	return sys_lchmod(l, v, retval);
 }
@@ -557,7 +557,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
+	CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
 
 	return sys_lchown(l, v, retval);
 }
@@ -573,7 +573,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
+	CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
 
 	return sys_lutimes(l, v, retval);
 }
@@ -589,7 +589,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys___posix_chown(l, v, retval);
 }
--- a/sys/compat/aoutm68k/aoutm68k_misc.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/aoutm68k/aoutm68k_misc.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: aoutm68k_misc.c,v 1.6 2003/01/18 07:21:14 thorpej Exp $	*/
+/*	$NetBSD: aoutm68k_misc.c,v 1.7 2003/06/28 14:21:16 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1998-2000 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aoutm68k_misc.c,v 1.6 2003/01/18 07:21:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aoutm68k_misc.c,v 1.7 2003/06/28 14:21:16 darrenr Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ktrace.h"
@@ -75,7 +75,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_open(l, v, retval);
 }
@@ -91,7 +91,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_link(l, v, retval);
 }
@@ -107,7 +107,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_unlink(l, v, retval);
 }
@@ -123,7 +123,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_chdir(l, v, retval);
 }
@@ -139,7 +139,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_chmod(l, v, retval);
 }
@@ -155,7 +155,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_chown(l, v, retval);
 }
@@ -171,7 +171,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_access(l, v, retval);
 }
@@ -187,7 +187,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_chflags(l, v, retval);
 }
@@ -203,7 +203,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_revoke(l, v, retval);
 }
@@ -219,7 +219,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_symlink(l, v, retval);
 }
@@ -235,7 +235,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
+	CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
 
 	return sys_readlink(l, v, retval);
 }
@@ -251,7 +251,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_execve(l, v, retval);
 }
@@ -267,7 +267,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_chroot(l, v, retval);
 }
@@ -283,7 +283,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, from));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, from));
 
 	return sys_rename(l, v, retval);
 }
@@ -300,7 +300,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return compat_43_sys_truncate(l, v, retval);
 }
@@ -317,7 +317,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_rmdir(l, v, retval);
 }
@@ -333,7 +333,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_utimes(l, v, retval);
 }
@@ -349,7 +349,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_statfs(l, v, retval);
 }
@@ -366,7 +366,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, fname));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, fname));
 
 	return sys_getfh(l, v, retval);
 }
@@ -383,7 +383,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_pathconf(l, v, retval);
 }
@@ -399,7 +399,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_truncate(l, v, retval);
 }
@@ -415,7 +415,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys_undelete(l, v, retval);
 }
@@ -431,7 +431,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, from));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, from));
 
 	return sys___posix_rename(l, v, retval);
 }
@@ -447,7 +447,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
+	CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
 
 	return sys_lchmod(l, v, retval);
 }
@@ -463,7 +463,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
+	CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
 
 	return sys_lchown(l, v, retval);
 }
@@ -479,7 +479,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
+	CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
 
 	return sys_lutimes(l, v, retval);
 }
@@ -495,7 +495,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return sys___posix_chown(l, v, retval);
 }
--- a/sys/compat/aoutm68k/aoutm68k_stat.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/aoutm68k/aoutm68k_stat.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: aoutm68k_stat.c,v 1.8 2003/04/02 22:14:23 he Exp $	*/
+/*	$NetBSD: aoutm68k_stat.c,v 1.9 2003/06/28 14:21:16 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aoutm68k_stat.c,v 1.8 2003/04/02 22:14:23 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aoutm68k_stat.c,v 1.9 2003/06/28 14:21:16 darrenr Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -85,7 +85,7 @@
 
 	SCARG(&cup, ub) = stackgap_alloc(p, &sg, sizeof(st));
 #ifdef COMPAT_AOUT_ALTPATH
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 #endif
 	SCARG(&cup, path) = SCARG(uap, path);
 
@@ -140,7 +140,7 @@
 
 	SCARG(&cup, ub) = stackgap_alloc(p, &sg, sizeof(st));
 #ifdef COMPAT_AOUT_ALTPATH
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 #endif
 	SCARG(&cup, path) = SCARG(uap, path);
 
@@ -171,7 +171,7 @@
 
 	SCARG(&cup, ub) = stackgap_alloc(p, &sg, sizeof(st));
 #ifdef COMPAT_AOUT_ALTPATH
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 #endif
 	SCARG(&cup, path) = SCARG(uap, path);
 
@@ -226,7 +226,7 @@
 
 	SCARG(&cup, ub) = stackgap_alloc(p, &sg, sizeof(st));
 #ifdef COMPAT_AOUT_ALTPATH
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 #endif
 	SCARG(&cup, path) = SCARG(uap, path);
 
@@ -256,7 +256,7 @@
 
 	SCARG(&cup, ub) = stackgap_alloc(p, &sg, sizeof(st));
 #ifdef COMPAT_AOUT_ALTPATH
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 #endif
 	SCARG(&cup, path) = SCARG(uap, path);
 
@@ -312,7 +312,7 @@
 
 	SCARG(&cup, ub) = stackgap_alloc(p, &sg, sizeof(st));
 #ifdef COMPAT_AOUT_ALTPATH
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 #endif
 	SCARG(&cup, path) = SCARG(uap, path);
 
--- a/sys/compat/common/compat_file.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/common/compat_file.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_file.c,v 1.8 2003/06/05 19:42:55 christos Exp $ */
+/*	$NetBSD: compat_file.c,v 1.9 2003/06/28 14:21:16 darrenr Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_file.c,v 1.8 2003/06/05 19:42:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_file.c,v 1.9 2003/06/28 14:21:16 darrenr Exp $");
 
 #include "opt_compat_darwin.h"
 #include "opt_nfsserver.h"
@@ -88,9 +88,9 @@
 	caddr_t sg = stackgap_init(p, 0);
 
 	if (SCARG(uap, flags) & O_CREAT)
-		CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
+		CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
 	else
-		CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+		CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_open(l, uap, retval);
 }
 
@@ -107,7 +107,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg  = stackgap_init(p, 0);
 
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
 	return compat_43_sys_creat(l, uap, retval);
 }
 
@@ -124,8 +124,8 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, link));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, link));
 	return sys_link(l, uap, retval);
 }
 
@@ -141,7 +141,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_unlink(l, uap, retval);
 }
 
@@ -157,7 +157,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_chdir(l, uap, retval);
 }
 
@@ -175,7 +175,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
 	return sys_mknod(l, uap, retval);
 }
 
@@ -192,7 +192,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_chmod(l, uap, retval);
 }
 
@@ -210,7 +210,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_chown(l, uap, retval);
 }
 
@@ -229,7 +229,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_mount(l, uap, retval);
 }
 
@@ -246,7 +246,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_unmount(l, uap, retval);
 }
 
@@ -263,7 +263,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_access(l, uap, retval);
 }
 
@@ -280,7 +280,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_chflags(l, uap, retval);
 }
 
@@ -297,7 +297,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return compat_43_sys_stat(l, uap, retval);
 }
 
@@ -314,7 +314,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return compat_43_sys_lstat(l, uap, retval);
 }
 
@@ -330,7 +330,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_acct(l, uap, retval);
 }
 
@@ -346,7 +346,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_revoke(l, uap, retval);
 }
 
@@ -363,8 +363,8 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, link));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, link));
 	return sys_symlink(l, uap, retval);
 }
 
@@ -382,7 +382,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
+	CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
 	return sys_readlink(l, uap, retval);
 }
 
@@ -402,7 +402,7 @@
 	caddr_t sg;
 
 	sg = stackgap_init(p, 0);
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	SCARG(&ap, path) = SCARG(uap, path);
 	SCARG(&ap, argp) = SCARG(uap, argp);
@@ -423,7 +423,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_chroot(l, uap, retval);
 }
 
@@ -439,7 +439,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, name));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, name));
 	return compat_12_sys_swapon(l, uap, retval);
 }
 
@@ -525,8 +525,8 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, from));
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, to));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, from));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, to));
 	return sys_rename(l, uap, retval);
 }
 
@@ -543,7 +543,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return compat_43_sys_truncate(l, uap, retval);
 }
 
@@ -560,7 +560,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
 	return sys_mkfifo(l, uap, retval);
 }
 
@@ -577,7 +577,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
 	return sys_mkdir(l, uap, retval);
 }
 
@@ -593,7 +593,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_rmdir(l, uap, retval);
 }
 
@@ -610,7 +610,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_utimes(l, uap, retval);
 }
 
@@ -630,7 +630,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_quotactl(l, uap, retval);
 }
 
@@ -647,7 +647,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_statfs(l, uap, retval);
 }
 
@@ -665,7 +665,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, fname));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, fname));
 	return sys_getfh(l, uap, retval);
 }
 #endif /* NFS || NFSSERVER */
@@ -683,7 +683,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return compat_12_sys_stat(l, uap, retval);
 }
 
@@ -700,7 +700,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return compat_12_sys_lstat(l, uap, retval);
 }
 
@@ -717,7 +717,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_pathconf(l, uap, retval);
 }
 
@@ -735,7 +735,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_truncate(l, uap, retval);
 }
 
@@ -751,7 +751,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_undelete(l, uap, retval);
 }
 
@@ -768,7 +768,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
+	CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
 	return sys_lchmod(l, uap, retval);
 }
 
@@ -786,7 +786,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
+	CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
 	return sys_lchown(l, uap, retval);
 }
 
@@ -803,7 +803,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_lutimes(l, uap, retval);
 }
 
@@ -820,7 +820,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys___stat13(l, uap, retval);
 }
 
@@ -837,7 +837,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys___lstat13(l, uap, retval);
 }
 
@@ -855,7 +855,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys___posix_chown(l, uap, retval);
 }
 
@@ -873,7 +873,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys___posix_lchown(l, uap, retval);
 }
 
@@ -890,7 +890,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_lchflags(l, uap, retval);
 }
 
--- a/sys/compat/common/compat_util.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/common/compat_util.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/* 	$NetBSD: compat_util.c,v 1.25 2002/11/29 17:08:06 jdolecek Exp $	*/
+/* 	$NetBSD: compat_util.c,v 1.26 2003/06/28 14:21:16 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_util.c,v 1.25 2002/11/29 17:08:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_util.c,v 1.26 2003/06/28 14:21:16 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -72,14 +72,15 @@
  * In case of error, the error number is returned and *pbuf = path.
  */
 int
-emul_find(p, sgp, prefix, path, pbuf, sflag)
-	struct proc	 *p;
+emul_find(l, sgp, prefix, path, pbuf, sflag)
+	struct lwp *l;
 	caddr_t		 *sgp;		/* Pointer to stackgap memory */
 	const char	 *prefix;
 	const char	 *path;
 	const char	**pbuf;
 	int		  sflag;
 {
+	struct proc *p;
 	struct nameidata	 nd;
 	struct nameidata	 ndroot;
 	struct vattr		 vat;
@@ -89,6 +90,7 @@
 	const char		*pr;
 	size_t			 sz, len;
 
+	p = l->l_proc;
 	buf = (char *)malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
 	*pbuf = path;
 
@@ -139,7 +141,7 @@
 			;
 		*cp = '\0';
 
-		NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, p);
+		NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, buf, l);
 
 		if ((error = namei(&nd)) != 0)
 			goto bad;
@@ -150,7 +152,7 @@
 	case CHECK_ALT_FL_SYMLINK:
 		NDINIT(&nd, LOOKUP,	
 			(sflag == CHECK_ALT_FL_SYMLINK) ? NOFOLLOW : FOLLOW,
-			UIO_SYSSPACE, buf, p);
+			UIO_SYSSPACE, buf, l);
 
 		if ((error = namei(&nd)) != 0)
 			goto bad;
@@ -163,15 +165,15 @@
 		 * root directory and never finding it, because "/" resolves
 		 * to the emulation root directory. This is expensive :-(
 		 */
-		NDINIT(&ndroot, LOOKUP, FOLLOW, UIO_SYSSPACE, prefix, p);
+		NDINIT(&ndroot, LOOKUP, FOLLOW, UIO_SYSSPACE, prefix, l);
 
 		if ((error = namei(&ndroot)) != 0)
 			goto bad2;
 
-		if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0)
+		if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, l)) != 0)
 			goto bad3;
 
-		if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, p))
+		if ((error = VOP_GETATTR(ndroot.ni_vp, &vatroot, p->p_ucred, l))
 		    != 0)
 			goto bad3;
 
@@ -220,12 +222,12 @@
  * there, check if the interpreter exists in within 'proper' tree.
  */
 int
-emul_find_interp(struct proc *p, const char *prefix, char *itp)
+emul_find_interp(struct lwp *l, const char *prefix, char *itp)
 {
 	const char *bp;
 	int error;
 
-	if (emul_find(p, NULL, prefix, itp, &bp, CHECK_ALT_FL_EXISTS) == 0) {
+	if (emul_find(l, NULL, prefix, itp, &bp, CHECK_ALT_FL_EXISTS) == 0) {
 		size_t len;
 
 		if ((error = copystr(bp, itp, MAXPATHLEN, &len)))
@@ -235,7 +237,7 @@
 		/* check filename without the emul prefix */
 		struct nameidata nd;
 	
-		NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, itp, p);
+		NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, itp, l);
 
 		if ((error = namei(&nd)))
 			return error;
--- a/sys/compat/common/compat_util.h	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/common/compat_util.h	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_util.h,v 1.12 2002/11/29 17:08:07 jdolecek Exp $	*/
+/*	$NetBSD: compat_util.h,v 1.13 2003/06/28 14:21:16 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -79,10 +79,10 @@
 caddr_t	stackgap_init(const struct proc *, size_t);
 void	*stackgap_alloc(const struct proc *, caddr_t *, size_t);
 
-int emul_find(struct proc *, caddr_t *, const char *, const char *,
+int emul_find(struct lwp *, caddr_t *, const char *, const char *,
 		   const char **, int);
 
-int emul_find_interp(struct proc *, const char *, char *);
+int emul_find_interp(struct lwp *, const char *, char *);
 
 unsigned long emul_flags_translate(const struct emul_flags_xtab *tab,
 				   unsigned long in, unsigned long *leftover);
@@ -93,13 +93,13 @@
 #define	CHECK_ALT_FL_CREAT	1
 #define	CHECK_ALT_FL_SYMLINK	2
 
-#define CHECK_ALT_EXIST(p, sgp, path) \
-    emul_find(p, sgp, p->p_emul->e_path, path, &(path), CHECK_ALT_FL_EXISTS)
+#define CHECK_ALT_EXIST(l, sgp, path) \
+    emul_find(l, sgp, l->l_proc->p_emul->e_path, path, &(path), CHECK_ALT_FL_EXISTS)
 
-#define CHECK_ALT_CREAT(p, sgp, path) \
-    emul_find(p, sgp, p->p_emul->e_path, path, &(path), CHECK_ALT_FL_CREAT)
+#define CHECK_ALT_CREAT(l, sgp, path) \
+    emul_find(l, sgp, l->l_proc->p_emul->e_path, path, &(path), CHECK_ALT_FL_CREAT)
 
-#define CHECK_ALT_SYMLINK(p, sgp, path) \
-    emul_find(p, sgp, p->p_emul->e_path, path, &(path), CHECK_ALT_FL_SYMLINK)
+#define CHECK_ALT_SYMLINK(l, sgp, path) \
+    emul_find(l, sgp, l->l_proc->p_emul->e_path, path, &(path), CHECK_ALT_FL_SYMLINK)
 
 #endif /* !_COMPAT_UTIL_H_ */
--- a/sys/compat/common/kern_info_09.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/common/kern_info_09.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_info_09.c,v 1.10 2003/01/18 07:28:34 thorpej Exp $	*/
+/*	$NetBSD: kern_info_09.c,v 1.11 2003/06/28 14:21:16 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_info_09.c,v 1.10 2003/01/18 07:28:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_info_09.c,v 1.11 2003/06/28 14:21:16 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -60,13 +60,12 @@
 		syscallarg(char *) domainname;
 		syscallarg(int) len;
 	} */ *uap = v;
-	struct proc *p = l->l_proc;
 	int name;
 	size_t sz;
 
 	name = KERN_DOMAINNAME;
 	sz = SCARG(uap,len);
-	return (kern_sysctl(&name, 1, SCARG(uap, domainname), &sz, 0, 0, p));
+	return (kern_sysctl(&name, 1, SCARG(uap, domainname), &sz, 0, 0, l));
 }
 
 
@@ -86,7 +85,7 @@
 		return (error);
 	name = KERN_DOMAINNAME;
 	return (kern_sysctl(&name, 1, 0, 0, SCARG(uap, domainname),
-			    SCARG(uap, len), p));
+			    SCARG(uap, len), l));
 }
 
 struct outsname {
--- a/sys/compat/common/kern_info_43.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/common/kern_info_43.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_info_43.c,v 1.14 2003/01/18 07:28:34 thorpej Exp $	*/
+/*	$NetBSD: kern_info_43.c,v 1.15 2003/06/28 14:21:16 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_info_43.c,v 1.14 2003/01/18 07:28:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_info_43.c,v 1.15 2003/06/28 14:21:16 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -90,13 +90,12 @@
 		syscallarg(char *) hostname;
 		syscallarg(u_int) len;
 	} */ *uap = v;
-	struct proc *p = l->l_proc;
 	int name;
 	size_t sz;
 
 	name = KERN_HOSTNAME;
 	sz = SCARG(uap, len);
-	return (kern_sysctl(&name, 1, SCARG(uap, hostname), &sz, 0, 0, p));
+	return (kern_sysctl(&name, 1, SCARG(uap, hostname), &sz, 0, 0, l));
 }
 
 #define	KINFO_PROC		(0<<8)
@@ -150,7 +149,6 @@
 		syscallarg(int *) size;
 		syscallarg(int) arg;
 	} */ *uap = v;
-	struct proc *p = l->l_proc;
 	int error, name[5];
 	size_t size;
 
@@ -167,13 +165,13 @@
 		name[3] = SCARG(uap, op) & 0xff;
 		name[4] = SCARG(uap, arg);
 		error =
-		    net_sysctl(name, 5, SCARG(uap, where), &size, NULL, 0, p);
+		    net_sysctl(name, 5, SCARG(uap, where), &size, NULL, 0, l);
 		break;
 
 	case KINFO_VNODE:
 		name[0] = KERN_VNODE;
 		error =
-		    kern_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p);
+		    kern_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, l);
 		break;
 
 	case KINFO_PROC:
@@ -181,31 +179,31 @@
 		name[1] = SCARG(uap, op) & 0xff;
 		name[2] = SCARG(uap, arg);
 		error =
-		    kern_sysctl(name, 3, SCARG(uap, where), &size, NULL, 0, p);
+		    kern_sysctl(name, 3, SCARG(uap, where), &size, NULL, 0, l);
 		break;
 
 	case KINFO_FILE:
 		name[0] = KERN_FILE;
 		error =
-		    kern_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p);
+		    kern_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, l);
 		break;
 
 	case KINFO_METER:
 		name[0] = VM_METER;
 		error =
-		    uvm_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p);
+		    uvm_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, l);
 		break;
 
 	case KINFO_LOADAVG:
 		name[0] = VM_LOADAVG;
 		error =
-		    uvm_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p);
+		    uvm_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, l);
 		break;
 
 	case KINFO_CLOCKRATE:
 		name[0] = KERN_CLOCKRATE;
 		error =
-		    kern_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, p);
+		    kern_sysctl(name, 1, SCARG(uap, where), &size, NULL, 0, l);
 		break;
 
 
@@ -307,5 +305,5 @@
 		return (error);
 	name = KERN_HOSTNAME;
 	return (kern_sysctl(&name, 1, 0, 0, SCARG(uap, hostname),
-			    SCARG(uap, len), p));
+			    SCARG(uap, len), l));
 }
--- a/sys/compat/common/tty_43.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/common/tty_43.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_43.c,v 1.14 2002/03/17 19:40:53 atatat Exp $	*/
+/*	$NetBSD: tty_43.c,v 1.15 2003/06/28 14:21:17 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty_43.c,v 1.14 2002/03/17 19:40:53 atatat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_43.c,v 1.15 2003/06/28 14:21:17 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -99,12 +99,12 @@
 
 /*ARGSUSED*/
 int
-ttcompat(tp, com, data, flag, p)
+ttcompat(tp, com, data, flag, l)
 	struct tty *tp;
 	u_long com;
 	caddr_t data;
 	int flag;
-	struct proc *p;
+	struct lwp *l;
 {
 
 	switch (com) {
@@ -147,7 +147,7 @@
 		tp->t_flags = (ttcompatgetflags(tp)&0xffff0000) | (sg->sg_flags&0xffff);
 		ttcompatsetflags(tp, &term);
 		return (ttioctl(tp, com == TIOCSETP ? TIOCSETAF : TIOCSETA,
-			(caddr_t)&term, flag, p));
+			(caddr_t)&term, flag, l));
 	}
 
 	case TIOCGETC: {
@@ -220,7 +220,7 @@
 			break;
 		}
 		ttcompatsetlflags(tp, &term);
-		return (ttioctl(tp, TIOCSETA, (caddr_t)&term, flag, p));
+		return (ttioctl(tp, TIOCSETA, (caddr_t)&term, flag, l));
 	}
 	case TIOCLGET:
 		*(int *)data = ttcompatgetflags(tp)>>16;
@@ -237,12 +237,12 @@
 
 		return (ttioctl(tp, TIOCSETD,
 			*(int *)data == 2 ? (caddr_t)&ldisczero : data, flag,
-			p));
+			l));
 	    }
 
 	case OTIOCCONS:
 		*(int *)data = 1;
-		return (ttioctl(tp, TIOCCONS, data, flag, p));
+		return (ttioctl(tp, TIOCCONS, data, flag, l));
 
 	case TIOCHPCL:
 		SET(tp->t_cflag, HUPCL);
--- a/sys/compat/common/uipc_syscalls_43.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/common/uipc_syscalls_43.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls_43.c,v 1.19 2003/01/18 07:28:34 thorpej Exp $	*/
+/*	$NetBSD: uipc_syscalls_43.c,v 1.20 2003/06/28 14:21:17 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_43.c,v 1.19 2003/01/18 07:28:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_43.c,v 1.20 2003/06/28 14:21:17 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -237,7 +237,7 @@
 		msg.msg_controllen = 0;
 	}
 
-	error = recvit(p, SCARG(uap, s), &msg,
+	error = recvit(l, SCARG(uap, s), &msg,
 	    (caddr_t)&SCARG(uap, msg)->msg_namelen, retval);
 
 	/*
@@ -415,7 +415,7 @@
 		msg.msg_controllen = 0;
 	}
 
-	error = sendit(p, SCARG(uap, s), &msg, SCARG(uap, flags), retval);
+	error = sendit(l, SCARG(uap, s), &msg, SCARG(uap, flags), retval);
 done:
 	if (iov != aiov)
 		FREE(iov, M_IOV);
--- a/sys/compat/common/vfs_syscalls_12.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/common/vfs_syscalls_12.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_12.c,v 1.11 2003/01/18 07:28:34 thorpej Exp $	*/
+/*	$NetBSD: vfs_syscalls_12.c,v 1.12 2003/06/28 14:21:17 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.11 2003/01/18 07:28:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_12.c,v 1.12 2003/06/28 14:21:17 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -120,12 +120,12 @@
 	loff = fp->f_offset;
 
 	error = vn_readdir(fp, SCARG(uap, buf), UIO_USERSPACE,
-			SCARG(uap, count), &done, p, 0, 0);
+			SCARG(uap, count), &done, l, 0, 0);
 
 	error = copyout(&loff, SCARG(uap, basep), sizeof(long));
 	*retval = done;
  out:
-	FILE_UNUSE(fp, p);
+	FILE_UNUSE(fp, l);
 	return error;
 }
 
@@ -140,17 +140,16 @@
 		syscallarg(const char *) path;
 		syscallarg(struct stat12 *) ub;
 	} */ *uap = v;
-	struct proc *p = l->l_proc;
 	struct stat sb;
 	struct stat12 osb;
 	int error;
 	struct nameidata nd;
 
 	NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
-	    SCARG(uap, path), p);
+	    SCARG(uap, path), l);
 	if ((error = namei(&nd)) != 0)
 		return (error);
-	error = vn_stat(nd.ni_vp, &sb, p);
+	error = vn_stat(nd.ni_vp, &sb, l);
 	vput(nd.ni_vp);
 	if (error)
 		return (error);
@@ -171,17 +170,16 @@
 		syscallarg(const char *) path;
 		syscallarg(struct stat12 *) ub;
 	} */ *uap = v;
-	struct proc *p = l->l_proc;
 	struct stat sb;
 	struct stat12 osb;
 	int error;
 	struct nameidata nd;
 
 	NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF, UIO_USERSPACE,
-	    SCARG(uap, path), p);
+	    SCARG(uap, path), l);
 	if ((error = namei(&nd)) != 0)
 		return (error);
-	error = vn_stat(nd.ni_vp, &sb, p);
+	error = vn_stat(nd.ni_vp, &sb, l);
 	vput(nd.ni_vp);
 	if (error)
 		return (error);
@@ -213,8 +211,8 @@
 		return (EBADF);
 
 	FILE_USE(fp);
-	error = (*fp->f_ops->fo_stat)(fp, &ub, p);
-	FILE_UNUSE(fp, p);
+	error = (*fp->f_ops->fo_stat)(fp, &ub, l);
+	FILE_UNUSE(fp, l);
 
 	if (error == 0) {
 		cvtstat(&ub, &oub);
--- a/sys/compat/common/vfs_syscalls_43.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/common/vfs_syscalls_43.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_43.c,v 1.22 2003/01/18 07:28:34 thorpej Exp $	*/
+/*	$NetBSD: vfs_syscalls_43.c,v 1.23 2003/06/28 14:21:17 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.22 2003/01/18 07:28:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_43.c,v 1.23 2003/06/28 14:21:17 darrenr Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "fs_union.h"
@@ -112,17 +112,16 @@
 		syscallarg(char *) path;
 		syscallarg(struct stat43 *) ub;
 	} */ *uap = v;
-	struct proc *p = l->l_proc;
 	struct stat sb;
 	struct stat43 osb;
 	int error;
 	struct nameidata nd;
 
 	NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
-	    SCARG(uap, path), p);
+	    SCARG(uap, path), l);
 	if ((error = namei(&nd)) != 0)
 		return (error);
-	error = vn_stat(nd.ni_vp, &sb, p);
+	error = vn_stat(nd.ni_vp, &sb, l);
 	vput(nd.ni_vp);
 	if (error)
 		return (error);
@@ -142,7 +141,6 @@
 		syscallarg(char *) path;
 		syscallarg(struct ostat *) ub;
 	} */ *uap = v;
-	struct proc *p = l->l_proc;
 	struct vnode *vp, *dvp;
 	struct stat sb, sb1;
 	struct stat43 osb;
@@ -152,7 +150,7 @@
 
 	ndflags = NOFOLLOW | LOCKLEAF | LOCKPARENT;
 again:
-	NDINIT(&nd, LOOKUP, ndflags, UIO_USERSPACE, SCARG(uap, path), p);
+	NDINIT(&nd, LOOKUP, ndflags, UIO_USERSPACE, SCARG(uap, path), l);
 	if ((error = namei(&nd))) {
 		if (error == EISDIR && (ndflags & LOCKPARENT) != 0) {
 			/*
@@ -177,18 +175,18 @@
 			else
 				vput(dvp);
 		}
-		error = vn_stat(vp, &sb, p);
+		error = vn_stat(vp, &sb, l);
 		vput(vp);
 		if (error)
 			return (error);
 	} else {
-		error = vn_stat(dvp, &sb, p);
+		error = vn_stat(dvp, &sb, l);
 		vput(dvp);
 		if (error) {
 			vput(vp);
 			return (error);
 		}
-		error = vn_stat(vp, &sb1, p);
+		error = vn_stat(vp, &sb1, l);
 		vput(vp);
 		if (error)
 			return (error);
@@ -226,8 +224,8 @@
 		return (EBADF);
 
 	FILE_USE(fp);
-	error = (*fp->f_ops->fo_stat)(fp, &ub, p);
-	FILE_UNUSE(fp, p);
+	error = (*fp->f_ops->fo_stat)(fp, &ub, l);
+	FILE_UNUSE(fp, l);
 
 	if (error == 0) {
 		cvtstat(&ub, &oub);
@@ -386,7 +384,7 @@
 	auio.uio_iovcnt = 1;
 	auio.uio_rw = UIO_READ;
 	auio.uio_segflg = UIO_USERSPACE;
-	auio.uio_procp = p;
+	auio.uio_lwp = l;
 	auio.uio_resid = SCARG(uap, count);
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	loff = auio.uio_offset = fp->f_offset;
@@ -462,7 +460,7 @@
 			 * If the directory is opaque,
 			 * then don't show lower entries
 			 */
-			error = VOP_GETATTR(vp, &va, fp->f_cred, p);
+			error = VOP_GETATTR(vp, &va, fp->f_cred, l);
 			if (va.va_flags & OPAQUE) {
 				vput(lvp);
 				lvp = NULL;
@@ -470,7 +468,7 @@
 		}
 		
 		if (lvp != NULLVP) {
-			error = VOP_OPEN(lvp, FREAD, fp->f_cred, p);
+			error = VOP_OPEN(lvp, FREAD, fp->f_cred, l);
 			VOP_UNLOCK(lvp, 0);
 
 			if (error) {
@@ -479,7 +477,7 @@
 			}
 			fp->f_data = (caddr_t) lvp;
 			fp->f_offset = 0;
-			error = vn_close(vp, FREAD, fp->f_cred, p);
+			error = vn_close(vp, FREAD, fp->f_cred, l);
 			if (error)
 				goto out;
 			vp = lvp;
@@ -504,6 +502,6 @@
 	    sizeof(long));
 	*retval = SCARG(uap, count) - auio.uio_resid;
  out:
-	FILE_UNUSE(fp, p);
+	FILE_UNUSE(fp, l);
 	return (error);
 }
--- a/sys/compat/darwin/darwin_exec.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/darwin/darwin_exec.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: darwin_exec.c,v 1.14 2003/06/23 11:01:53 martin Exp $ */
+/*	$NetBSD: darwin_exec.c,v 1.15 2003/06/28 14:21:17 darrenr Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include "opt_compat_darwin.h" /* For COMPAT_DARWIN in mach_port.h */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: darwin_exec.c,v 1.14 2003/06/23 11:01:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: darwin_exec.c,v 1.15 2003/06/28 14:21:17 darrenr Exp $");
 
 #include "opt_syscall_debug.h"
 
@@ -117,8 +117,8 @@
  * extra information in case of dynamic binding.
  */
 int
-exec_darwin_copyargs(p, pack, arginfo, stackp, argp)
-	struct proc *p;
+exec_darwin_copyargs(l, pack, arginfo, stackp, argp)
+	struct lwp *l;
 	struct exec_package *pack;
 	struct ps_strings *arginfo;
 	char **stackp;
--- a/sys/compat/darwin/darwin_exec.h	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/darwin/darwin_exec.h	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: darwin_exec.h,v 1.4 2002/12/28 00:15:23 manu Exp $ */
+/*	$NetBSD: darwin_exec.h,v 1.5 2003/06/28 14:21:17 darrenr Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
 	pid_t ded_fakepid;
 };
 
-int exec_darwin_copyargs(struct proc *, struct exec_package *, 
+int exec_darwin_copyargs(struct lwp *, struct exec_package *, 
     struct ps_strings *, char **, void *);
 int exec_darwin_probe(char **);
 extern const struct emul emul_darwin;
--- a/sys/compat/darwin/darwin_mman.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/darwin/darwin_mman.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,6 +1,6 @@
 #undef DEBUG_DARWIN
 #undef DEBUG_MACH
-/*	$NetBSD: darwin_mman.c,v 1.7 2003/01/24 21:37:02 manu Exp $ */
+/*	$NetBSD: darwin_mman.c,v 1.8 2003/06/28 14:21:17 darrenr Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: darwin_mman.c,v 1.7 2003/01/24 21:37:02 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: darwin_mman.c,v 1.8 2003/06/28 14:21:17 darrenr Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -218,7 +218,7 @@
 		    i, evc.ev_addr, evc.ev_len));
 
 		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-		if ((error = (*evc.ev_proc)(p, &evc)) != 0) {
+		if ((error = (*evc.ev_proc)(l, &evc)) != 0) {
 			VOP_UNLOCK(vp, 0);
 			DPRINTF(("Failed\n"));
 			goto bad2;
@@ -230,7 +230,7 @@
 	free(mapp, M_TEMP);
 bad3:
 	vrele(vp);
-	FILE_UNUSE(fp, p);
+	FILE_UNUSE(fp, l);
 	SCARG(&close_cup, fd) = fd;
 	if ((error = sys_close(l, &close_cup, retval)) != 0)
 		return error;
--- a/sys/compat/darwin/darwin_sysctl.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/darwin/darwin_sysctl.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: darwin_sysctl.c,v 1.10 2003/01/24 21:37:02 manu Exp $ */
+/*	$NetBSD: darwin_sysctl.c,v 1.11 2003/06/28 14:21:17 darrenr Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: darwin_sysctl.c,v 1.10 2003/01/24 21:37:02 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: darwin_sysctl.c,v 1.11 2003/06/28 14:21:17 darrenr Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -60,21 +60,21 @@
 pid_t darwin_init_pid = 0;
 
 static int darwin_kern_sysctl
-    (int *, u_int, void *, size_t *, void *, size_t, struct proc *);
+    (int *, u_int, void *, size_t *, void *, size_t, struct lwp *);
 static int darwin_vm_sysctl
-    (int *, u_int, void *, size_t *, void *, size_t, struct proc *);
+    (int *, u_int, void *, size_t *, void *, size_t, struct lwp *);
 static int darwin_vfs_sysctl
-    (int *, u_int, void *, size_t *, void *, size_t, struct proc *);
+    (int *, u_int, void *, size_t *, void *, size_t, struct lwp *);
 static int darwin_net_sysctl
-    (int *, u_int, void *, size_t *, void *, size_t, struct proc *);
+    (int *, u_int, void *, size_t *, void *, size_t, struct lwp *);
 static int darwin_debug_sysctl
-    (int *, u_int, void *, size_t *, void *, size_t, struct proc *);
+    (int *, u_int, void *, size_t *, void *, size_t, struct lwp *);
 static int darwin_hw_sysctl
-    (int *, u_int, void *, size_t *, void *, size_t, struct proc *);
+    (int *, u_int, void *, size_t *, void *, size_t, struct lwp *);
 static int darwin_machdep_sysctl
-    (int *, u_int, void *, size_t *, void *, size_t, struct proc *);
+    (int *, u_int, void *, size_t *, void *, size_t, struct lwp *);
 static int darwin_user_sysctl
-    (int *, u_int, void *, size_t *, void *, size_t, struct proc *);
+    (int *, u_int, void *, size_t *, void *, size_t, struct lwp *);
 
 int
 darwin_sys___sysctl(struct lwp *l, void *v, register_t *retval)
@@ -165,7 +165,7 @@
 		savelen = oldlen;
 	}
 
-	error = (*fn)(name + 1, namelen - 1, oldp, oldlenp, newp, newlen, p);
+	error = (*fn)(name + 1, namelen - 1, oldp, oldlenp, newp, newlen, l);
 
 	if (oldp)
 		uvm_vsunlock(p, oldp, savelen);
@@ -181,14 +181,14 @@
 
 
 static int
-darwin_kern_sysctl(name, nlen, oldp, oldlenp, newp, newlen, p)
+darwin_kern_sysctl(name, nlen, oldp, oldlenp, newp, newlen, l)
 	int *name;
 	u_int nlen;
 	void *oldp;
 	size_t *oldlenp;
 	void *newp;
 	size_t newlen;
-	struct proc *p;
+	struct lwp *l;
 {
 	switch (name[0]) {
 	/* sysctl with the same definition */
@@ -215,7 +215,7 @@
 	case DARWIN_KERN_BOOTTIME:
 	case DARWIN_KERN_NISDOMAINNAME:
 	case DARWIN_KERN_MAXPARTITIONS:
-		return kern_sysctl(name, 1, oldp, oldlenp, newp, newlen, p);
+		return kern_sysctl(name, 1, oldp, oldlenp, newp, newlen, l);
 		break;
 	default:
 		return EOPNOTSUPP;
@@ -226,14 +226,14 @@
 }
 
 static int
-darwin_vm_sysctl(name, nlen, oldp, oldlenp, newp, newlen, p)
+darwin_vm_sysctl(name, nlen, oldp, oldlenp, newp, newlen, l)
 	int *name;
 	u_int nlen;
 	void *oldp;
 	size_t *oldlenp;
 	void *newp;
 	size_t newlen;
-	struct proc *p;
+	struct lwp *l;
 {
 	switch (name[0]) {
 	default:
@@ -245,14 +245,14 @@
 }
 
 static int
-darwin_vfs_sysctl(name, nlen, oldp, oldlenp, newp, newlen, p)
+darwin_vfs_sysctl(name, nlen, oldp, oldlenp, newp, newlen, l)
 	int *name;
 	u_int nlen;
 	void *oldp;
 	size_t *oldlenp;
 	void *newp;
 	size_t newlen;
-	struct proc *p;
+	struct lwp *l;
 {
 	switch (name[0]) {
 	default:
@@ -264,14 +264,14 @@
 }
 
 static int
-darwin_net_sysctl(name, nlen, oldp, oldlenp, newp, newlen, p)
+darwin_net_sysctl(name, nlen, oldp, oldlenp, newp, newlen, l)
 	int *name;
 	u_int nlen;
 	void *oldp;
 	size_t *oldlenp;
 	void *newp;
 	size_t newlen;
-	struct proc *p;
+	struct lwp *l;
 {
 	switch (name[0]) {
 	default:
@@ -283,14 +283,14 @@
 }
 
 static int
-darwin_debug_sysctl(name, nlen, oldp, oldlenp, newp, newlen, p)
+darwin_debug_sysctl(name, nlen, oldp, oldlenp, newp, newlen, l)
 	int *name;
 	u_int nlen;
 	void *oldp;
 	size_t *oldlenp;
 	void *newp;
 	size_t newlen;
-	struct proc *p;
+	struct lwp *l;
 {
 	switch (name[0]) {
 	default:
@@ -302,19 +302,19 @@
 }
 
 static int
-darwin_hw_sysctl(name, nlen, oldp, oldlenp, newp, newlen, p)
+darwin_hw_sysctl(name, nlen, oldp, oldlenp, newp, newlen, l)
 	int *name;
 	u_int nlen;
 	void *oldp;
 	size_t *oldlenp;
 	void *newp;
 	size_t newlen;
-	struct proc *p;
+	struct lwp *l;
 {
 	switch (name[0]) {
 	case DARWIN_HW_NCPU:
 		name[0] = HW_NCPU;
-		return hw_sysctl(name, 1, oldp, oldlenp, newp, newlen, p);
+		return hw_sysctl(name, 1, oldp, oldlenp, newp, newlen, l);
 		break;
 	case DARWIN_HW_VECTORUNIT:
 		return sysctl_rdint(oldp, oldlenp, newp, 0);
@@ -328,14 +328,14 @@
 }
 
 static int
-darwin_machdep_sysctl(name, nlen, oldp, oldlenp, newp, newlen, p)
+darwin_machdep_sysctl(name, nlen, oldp, oldlenp, newp, newlen, l)
 	int *name;
 	u_int nlen;
 	void *oldp;
 	size_t *oldlenp;
 	void *newp;
 	size_t newlen;
-	struct proc *p;
+	struct lwp *l;
 {
 	switch (name[0]) {
 	default:
@@ -347,14 +347,14 @@
 }
 
 static int
-darwin_user_sysctl(name, nlen, oldp, oldlenp, newp, newlen, p)
+darwin_user_sysctl(name, nlen, oldp, oldlenp, newp, newlen, l)
 	int *name;
 	u_int nlen;
 	void *oldp;
 	size_t *oldlenp;
 	void *newp;
 	size_t newlen;
-	struct proc *p;
+	struct lwp *l;
 {
 	switch (name[0]) {
 	default:
@@ -366,14 +366,14 @@
 }
 
 int
-darwin_sysctl(name, nlen, oldp, oldlenp, newp, newlen, p)
+darwin_sysctl(name, nlen, oldp, oldlenp, newp, newlen, l)
 	int *name;
 	u_int nlen;
 	void *oldp;
 	size_t *oldlenp;
 	void *newp;
 	size_t newlen;
-	struct proc *p;
+	struct lwp *l;
 {
 	if (nlen != 1)
 		return EOPNOTSUPP;
--- a/sys/compat/darwin/darwin_sysctl.h	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/darwin/darwin_sysctl.h	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: darwin_sysctl.h,v 1.2 2002/12/24 12:15:46 manu Exp $ */
+/*	$NetBSD: darwin_sysctl.h,v 1.3 2003/06/28 14:21:17 darrenr Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
 }
 
 int darwin_sysctl(int *, u_int, void *, 
-    size_t *, void *, size_t, struct proc *);
+    size_t *, void *, size_t, struct lwp *);
 
 #define DARWIN_CTL_UNSPEC	0
 #define DARWIN_CTL_KERN		1
--- a/sys/compat/freebsd/freebsd_exec.h	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/freebsd/freebsd_exec.h	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: freebsd_exec.h,v 1.9 2003/02/19 09:45:49 jdolecek Exp $	*/
+/*	$NetBSD: freebsd_exec.h,v 1.10 2003/06/28 14:21:17 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -95,7 +95,7 @@
 
 #define	FREEBSD_AOUT_HDR_SIZE	sizeof(struct exec)
 
-int exec_freebsd_aout_makecmds __P((struct proc *, struct exec_package *));
+int exec_freebsd_aout_makecmds __P((struct lwp *, struct exec_package *));
 
 #endif /* EXEC_AOUT */
 
@@ -103,7 +103,7 @@
 #define FREEBSD_ELF_BRAND_STRING "FreeBSD"
 #define FREEBSD_ELF_INTERP_PREFIX_STRING "/usr/libexec/ld-elf.so"
 
-int freebsd_elf32_probe __P((struct proc *, struct exec_package *, void *,
+int freebsd_elf32_probe __P((struct lwp *, struct exec_package *, void *,
     char *, vaddr_t *));
 #endif /* EXEC_ELF32 */
 
--- a/sys/compat/freebsd/freebsd_exec_aout.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/freebsd/freebsd_exec_aout.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: freebsd_exec_aout.c,v 1.3 2001/11/13 02:08:07 lukem Exp $	*/
+/*	$NetBSD: freebsd_exec_aout.c,v 1.4 2003/06/28 14:21:17 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: freebsd_exec_aout.c,v 1.3 2001/11/13 02:08:07 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_exec_aout.c,v 1.4 2003/06/28 14:21:17 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -57,8 +57,8 @@
  */
 
 int
-exec_freebsd_aout_makecmds(p, epp)
-	struct proc *p;
+exec_freebsd_aout_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	u_long midmag;
@@ -73,16 +73,16 @@
 	/* assume FreeBSD's MID_MACHINE and [ZQNO]MAGIC is same as NetBSD's */
 	switch (midmag) {
 	case (MID_MACHINE << 16) | ZMAGIC:
-		error = exec_aout_prep_oldzmagic(p, epp);
+		error = exec_aout_prep_oldzmagic(l->l_proc, epp);
 		break;
 	case (MID_MACHINE << 16) | QMAGIC:
-		error = exec_aout_prep_zmagic(p, epp);
+		error = exec_aout_prep_zmagic(l->l_proc, epp);
 		break;
 	case (MID_MACHINE << 16) | NMAGIC:
-		error = exec_aout_prep_nmagic(p, epp);
+		error = exec_aout_prep_nmagic(l->l_proc, epp);
 		break;
 	case (MID_MACHINE << 16) | OMAGIC:
-		error = exec_aout_prep_omagic(p, epp);
+		error = exec_aout_prep_omagic(l->l_proc, epp);
 		break;
 	}
 	if (error)
--- a/sys/compat/freebsd/freebsd_exec_elf32.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/freebsd/freebsd_exec_elf32.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: freebsd_exec_elf32.c,v 1.9 2002/11/29 19:13:14 jdolecek Exp $	*/
+/*	$NetBSD: freebsd_exec_elf32.c,v 1.10 2003/06/28 14:21:17 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: freebsd_exec_elf32.c,v 1.9 2002/11/29 19:13:14 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_exec_elf32.c,v 1.10 2003/06/28 14:21:17 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -50,8 +50,8 @@
 #include <compat/common/compat_util.h>
 
 int
-ELFNAME2(freebsd,probe)(p, epp, veh, itp, pos)
-	struct proc *p;
+ELFNAME2(freebsd,probe)(l, epp, veh, itp, pos)
+	struct lwp *l;
 	struct exec_package *epp;
 	void *veh;
 	char *itp;
@@ -86,7 +86,7 @@
 	if (i != 0) {
 		phsize = i * sizeof(Elf_Phdr);
 		ph = (Elf_Phdr *) malloc(phsize, M_TEMP, M_WAITOK);
-		if ((error = exec_read_from(p, epp->ep_vp, eh->e_phoff, ph,
+		if ((error = exec_read_from(l, epp->ep_vp, eh->e_phoff, ph,
 		    phsize)) != 0)
 			goto bad1;
 
@@ -101,7 +101,7 @@
 			np = (Elf_Nhdr *) malloc(ephp->p_filesz+1,
 			    M_TEMP, M_WAITOK);
 
-			if (((error = exec_read_from(p, epp->ep_vp,
+			if (((error = exec_read_from(l, epp->ep_vp,
 			    ephp->p_offset, np, ephp->p_filesz)) != 0))
 				goto bad2;
 
@@ -116,8 +116,8 @@
 	}
 
 	if (itp[0]) {
-		if ((error = emul_find_interp(p, epp->ep_esch->es_emul->e_path,
-		    itp)))
+		if ((error = emul_find_interp(l,
+		    epp->ep_esch->es_emul->e_path, itp)))
 			return error;
 	}
 	*pos = ELF_NO_ADDR;
--- a/sys/compat/freebsd/freebsd_file.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/freebsd/freebsd_file.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: freebsd_file.c,v 1.17 2003/01/18 07:33:15 thorpej Exp $	*/
+/*	$NetBSD: freebsd_file.c,v 1.18 2003/06/28 14:21:17 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1995 Frank van der Linden
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: freebsd_file.c,v 1.17 2003/01/18 07:33:15 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_file.c,v 1.18 2003/06/28 14:21:17 darrenr Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "fs_nfs.h"
@@ -119,7 +119,7 @@
 	if ((error = copyout(type, s, strlen(type) + 1)) != 0)
 		return error;
 	SCARG(&bma, type) = s;
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	SCARG(&bma, path) = SCARG(uap, path);
 	SCARG(&bma, flags) = SCARG(uap, flags);
 	SCARG(&bma, data) = SCARG(uap, data);
@@ -149,9 +149,9 @@
 	caddr_t sg = stackgap_init(p, 0);
 
 	if (SCARG(uap, flags) & O_CREAT)
-		CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
+		CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
 	else
-		CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+		CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_open(l, uap, retval);
 }
 
@@ -168,7 +168,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg  = stackgap_init(p, 0);
 
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
 	return compat_43_sys_creat(l, uap, retval);
 }
 
@@ -185,8 +185,8 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, link));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, link));
 	return sys_link(l, uap, retval);
 }
 
@@ -202,7 +202,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_unlink(l, uap, retval);
 }
 
@@ -218,7 +218,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_chdir(l, uap, retval);
 }
 
@@ -236,7 +236,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
 	return sys_mknod(l, uap, retval);
 }
 
@@ -253,7 +253,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_chmod(l, uap, retval);
 }
 
@@ -271,7 +271,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_chown(l, uap, retval);
 }
 
@@ -289,7 +289,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
+	CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
 	return sys_lchown(l, uap, retval);
 }
 
@@ -306,7 +306,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_unmount(l, uap, retval);
 }
 
@@ -323,7 +323,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_access(l, uap, retval);
 }
 
@@ -340,7 +340,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_chflags(l, uap, retval);
 }
 
@@ -357,7 +357,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return compat_43_sys_stat(l, uap, retval);
 }
 
@@ -374,7 +374,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return compat_43_sys_lstat(l, uap, retval);
 }
 
@@ -390,7 +390,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_revoke(l, uap, retval);
 }
 
@@ -407,8 +407,8 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, link));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, link));
 	return sys_symlink(l, uap, retval);
 }
 
@@ -426,7 +426,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
+	CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
 	return sys_readlink(l, uap, retval);
 }
 
@@ -446,7 +446,7 @@
 	caddr_t sg;
 
 	sg = stackgap_init(p, 0);
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	SCARG(&ap, path) = SCARG(uap, path);
 	SCARG(&ap, argp) = SCARG(uap, argp);
@@ -467,7 +467,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_chroot(l, uap, retval);
 }
 
@@ -484,8 +484,8 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, from));
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, to));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, from));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, to));
 	return sys_rename(l, uap, retval);
 }
 
@@ -502,7 +502,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return compat_43_sys_truncate(l, uap, retval);
 }
 
@@ -519,7 +519,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
 	return sys_mkfifo(l, uap, retval);
 }
 
@@ -536,7 +536,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
 	return sys_mkdir(l, uap, retval);
 }
 
@@ -552,7 +552,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_rmdir(l, uap, retval);
 }
 
@@ -569,7 +569,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_statfs(l, uap, retval);
 }
 
@@ -587,7 +587,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, fname));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, fname));
 	return sys_getfh(l, uap, retval);
 }
 #endif /* NFS */
@@ -605,7 +605,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return compat_12_sys_stat(l, uap, retval);
 }
 
@@ -622,7 +622,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return compat_12_sys_lstat(l, uap, retval);
 }
 
@@ -639,7 +639,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_pathconf(l, uap, retval);
 }
 
@@ -657,6 +657,6 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 	return sys_truncate(l, uap, retval);
 }
--- a/sys/compat/freebsd/freebsd_ioctl.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/freebsd/freebsd_ioctl.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: freebsd_ioctl.c,v 1.7 2003/01/18 07:33:16 thorpej Exp $	*/
+/*	$NetBSD: freebsd_ioctl.c,v 1.8 2003/06/28 14:21:18 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1995 Frank van der Linden
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: freebsd_ioctl.c,v 1.7 2003/01/18 07:33:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_ioctl.c,v 1.8 2003/06/28 14:21:18 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -123,7 +123,6 @@
 		syscallarg(u_long) com;
 		syscallarg(caddr_t) data;
 	} */ *uap = v;
-	struct proc *p = l->l_proc;
         struct oss_sys_ioctl_args ap;
 	struct sys_ioctl_args nap;
 
@@ -139,13 +138,13 @@
 	switch (FREEBSD_IOCGROUP(SCARG(uap, com))) {
 	case 'M':
         	freebsd_to_oss(uap, &ap);
-		return oss_ioctl_mixer(p, &ap, retval);
+		return oss_ioctl_mixer(l, &ap, retval);
 	case 'Q':
         	freebsd_to_oss(uap, &ap);
-		return oss_ioctl_sequencer(p, &ap, retval);
+		return oss_ioctl_sequencer(l, &ap, retval);
 	case 'P':
         	freebsd_to_oss(uap, &ap);
-		return oss_ioctl_audio(p, &ap, retval);
+		return oss_ioctl_audio(l, &ap, retval);
 	case 'i':
 		freebsd_to_netbsd_ifioctl(uap, &nap);
 		return sys_ioctl(l, &nap, retval);
--- a/sys/compat/freebsd/freebsd_misc.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/freebsd/freebsd_misc.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: freebsd_misc.c,v 1.17 2003/01/18 07:33:16 thorpej Exp $	*/
+/*	$NetBSD: freebsd_misc.c,v 1.18 2003/06/28 14:21:18 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1995 Frank van der Linden
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: freebsd_misc.c,v 1.17 2003/01/18 07:33:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: freebsd_misc.c,v 1.18 2003/06/28 14:21:18 darrenr Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -177,7 +177,7 @@
 	struct proc *p = l->l_proc;
 
 	if (KTRPOINT(p, KTR_USER))
-		ktruser(p, "FreeBSD utrace", SCARG(uap, addr), SCARG(uap, len),
+		ktruser(l, "FreeBSD utrace", SCARG(uap, addr), SCARG(uap, len),
 			0);
 	
 	return (0);
--- a/sys/compat/hpux/hpux_compat.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/hpux/hpux_compat.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpux_compat.c,v 1.62 2003/02/19 11:23:53 jdolecek Exp $	*/
+/*	$NetBSD: hpux_compat.c,v 1.63 2003/06/28 14:21:18 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpux_compat.c,v 1.62 2003/02/19 11:23:53 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpux_compat.c,v 1.63 2003/06/28 14:21:18 darrenr Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sysv.h"
@@ -1061,7 +1061,7 @@
 	 */
 	if (error == 0) {
 		NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
-			SCARG(uap, path), p);
+			SCARG(uap, path), l);
 		error = namei(&nd);
 	}
 	if (error) {
@@ -1359,7 +1359,7 @@
 	vattr.va_mtime.tv_sec = tv[1];
 	vattr.va_mtime.tv_nsec = 0;
 	NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
-	    SCARG(uap, fname), p);
+	    SCARG(uap, fname), l);
 	if ((error = namei(&nd)))
 		return (error);
 	vp = nd.ni_vp;
--- a/sys/compat/hpux/hpux_exec.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/hpux/hpux_exec.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpux_exec.c,v 1.35 2003/01/18 07:36:56 thorpej Exp $	*/
+/*	$NetBSD: hpux_exec.c,v 1.36 2003/06/28 14:21:18 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpux_exec.c,v 1.35 2003/01/18 07:36:56 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpux_exec.c,v 1.36 2003/06/28 14:21:18 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -157,7 +157,7 @@
 	caddr_t sg;
 
 	sg = stackgap_init(p, 0);
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	SCARG(&ap, path) = SCARG(uap, path);
 	SCARG(&ap, argp) = SCARG(uap, argp);
@@ -182,7 +182,7 @@
 	caddr_t sg;
 
 	sg = stackgap_init(p, 0);
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	SCARG(&ap, path) = SCARG(uap, path);
 	SCARG(&ap, argp) = SCARG(uap, argp);
--- a/sys/compat/hpux/hpux_exec.h	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/hpux/hpux_exec.h	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpux_exec.h,v 1.11 2003/01/18 07:36:57 thorpej Exp $	*/
+/*	$NetBSD: hpux_exec.h,v 1.12 2003/06/28 14:21:18 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -153,7 +153,7 @@
 #define HPUXM_STKWT	0x02000000
 #define HPUXM_DATAWT	0x04000000
 
-int	exec_hpux_makecmds __P((struct proc *, struct exec_package *));
+int	exec_hpux_makecmds __P((struct lwp *, struct exec_package *));
 void	hpux_setregs __P((struct lwp *, struct exec_package *, u_long));
 
 extern const struct emul emul_hpux;
--- a/sys/compat/hpux/hpux_exec_aout.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/hpux/hpux_exec_aout.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpux_exec_aout.c,v 1.6 2003/04/01 01:49:22 thorpej Exp $	*/
+/*	$NetBSD: hpux_exec_aout.c,v 1.7 2003/06/28 14:21:18 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpux_exec_aout.c,v 1.6 2003/04/01 01:49:22 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpux_exec_aout.c,v 1.7 2003/06/28 14:21:18 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -103,8 +103,8 @@
 static	int exec_hpux_prep_omagic __P((struct proc *, struct exec_package *));
 
 int
-exec_hpux_makecmds(p, epp)
-	struct proc *p;
+exec_hpux_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	struct hpux_exec *hpux_ep = epp->ep_hdr;
@@ -129,15 +129,15 @@
 
 	switch (magic) {
 	case OMAGIC:
-		error = exec_hpux_prep_omagic(p, epp);
+		error = exec_hpux_prep_omagic(l->l_proc, epp);
 		break;
 
 	case NMAGIC:
-		error = exec_hpux_prep_nmagic(p, epp);
+		error = exec_hpux_prep_nmagic(l->l_proc, epp);
 		break;
 
 	case ZMAGIC:
-		error = exec_hpux_prep_zmagic(p, epp);
+		error = exec_hpux_prep_zmagic(l->l_proc, epp);
 		break;
 	}
 
--- a/sys/compat/hpux/hpux_file.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/hpux/hpux_file.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpux_file.c,v 1.22 2003/03/21 23:11:21 dsl Exp $	*/
+/*	$NetBSD: hpux_file.c,v 1.23 2003/06/28 14:21:18 darrenr Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpux_file.c,v 1.22 2003/03/21 23:11:21 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpux_file.c,v 1.23 2003/06/28 14:21:18 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -145,7 +145,7 @@
 	caddr_t sg;
 
 	sg = stackgap_init(p, 0);
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
 
 	SCARG(&oa, path) = SCARG(uap, path);
 	SCARG(&oa, flags) = O_CREAT | O_TRUNC | O_WRONLY;
@@ -210,9 +210,9 @@
 	 * Do the alternate pathname check.
 	 */
 	if (SCARG(&oa, flags) & O_CREAT)
-		CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
+		CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
 	else
-		CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+		CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	/*
 	 * Fill in the new arguments and call the NetBSD open(2).
@@ -487,7 +487,7 @@
 
 	sg = stackgap_init(p, 0);
 	st = stackgap_alloc(p, &sg, sizeof (struct stat));
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	SCARG(&sa, ub) = st;
 	SCARG(&sa, path) = SCARG(uap, path);
@@ -568,7 +568,7 @@
 
 	sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	st = stackgap_alloc(p, &sg, sizeof (struct stat));
 	SCARG(&sa, ub) = st;
@@ -667,7 +667,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return (sys_access(l, uap, retval));
 }
@@ -687,7 +687,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return (sys_unlink(l, uap, retval));
 }
@@ -707,7 +707,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return (sys_chdir(l, uap, retval));
 }
@@ -730,7 +730,7 @@
 	caddr_t sg = stackgap_init(p, 0);
 	struct sys_mkfifo_args bma;
 
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
 
 	/*
 	 * BSD handles FIFOs separately.
@@ -759,7 +759,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return (sys_chmod(l, uap, retval));
 }
@@ -781,7 +781,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	/* XXX What about older HP-UX executables? */
 
@@ -804,8 +804,8 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, from));
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, to));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, from));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, to));
 
 	return (sys___posix_rename(l, uap, retval));
 }
@@ -826,7 +826,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, path));
 
 	return (sys_mkdir(l, uap, retval));
 }
@@ -846,7 +846,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return (sys_rmdir(l, uap, retval));
 }
@@ -867,8 +867,8 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
-	CHECK_ALT_CREAT(p, &sg, SCARG(uap, link));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
+	CHECK_ALT_CREAT(l, &sg, SCARG(uap, link));
 
 	return (sys_symlink(l, uap, retval));
 }
@@ -890,7 +890,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
+	CHECK_ALT_SYMLINK(l, &sg, SCARG(uap, path));
 
 	return (sys_readlink(l, uap, retval));
 }
@@ -911,7 +911,7 @@
 	struct proc *p = l->l_proc;
 	caddr_t sg = stackgap_init(p, 0);
 
-	CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+	CHECK_ALT_EXIST(l, &sg, SCARG(uap, path));
 
 	return (compat_43_sys_truncate(l, uap, retval));
 }
--- a/sys/compat/ibcs2/ibcs2_exec.h	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/ibcs2/ibcs2_exec.h	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: ibcs2_exec.h,v 1.10 2003/02/19 09:45:48 jdolecek Exp $	*/
+/*	$NetBSD: ibcs2_exec.h,v 1.11 2003/06/28 14:21:18 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995, 1998 Scott Bartram
@@ -55,7 +55,7 @@
 #define IBCS2_CVT_HIGH_SYSCALL(n)	(((n) >> 8) + 200)
 
 struct exec_package;
-int     exec_ibcs2_coff_makecmds __P((struct proc *, struct exec_package *));
+int     exec_ibcs2_coff_makecmds __P((struct lwp *, struct exec_package *));
 
 /*
  * x.out (XENIX)
@@ -180,10 +180,10 @@
 
 #define XOUT_HDR_SIZE		(sizeof(struct xexec) + sizeof(struct xext))
 
-int     exec_ibcs2_xout_makecmds __P((struct proc *, struct exec_package *));
+int     exec_ibcs2_xout_makecmds __P((struct lwp *, struct exec_package *));
 
 #ifdef EXEC_ELF32
-int	ibcs2_elf32_probe __P((struct proc *, struct exec_package *,
+int	ibcs2_elf32_probe __P((struct lwp *, struct exec_package *,
 			       void *, char *, vaddr_t *));
 #endif
 
--- a/sys/compat/ibcs2/ibcs2_exec_coff.c	Sat Jun 28 14:18:30 2003 +0000
+++ b/sys/compat/ibcs2/ibcs2_exec_coff.c	Sat Jun 28 14:20:43 2003 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: ibcs2_exec_coff.c,v 1.5 2002/10/05 22:34:04 chs Exp $	*/
+/*	$NetBSD: ibcs2_exec_coff.c,v 1.6 2003/06/28 14:21:18 darrenr Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995, 1998 Scott Bartram
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibcs2_exec_coff.c,v 1.5 2002/10/05 22:34:04 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_exec_coff.c,v 1.6 2003/06/28 14:21:18 darrenr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -61,22 +61,22 @@
 #include <compat/ibcs2/ibcs2_util.h>
 
 
-int exec_ibcs2_coff_prep_omagic __P((struct proc *, struct exec_package *,
+int exec_ibcs2_coff_prep_omagic __P((struct lwp *, struct exec_package *,
 				     struct coff_filehdr *, 
 				     struct coff_aouthdr *));
-int exec_ibcs2_coff_prep_nmagic __P((struct proc *, struct exec_package *,
+int exec_ibcs2_coff_prep_nmagic __P((struct lwp *, struct exec_package *,
 				     struct coff_filehdr *, 
 				     struct coff_aouthdr *));
-int exec_ibcs2_coff_prep_zmagic __P((struct proc *, struct exec_package *,
+int exec_ibcs2_coff_prep_zmagic __P((struct lwp *, struct exec_package *,
 				     struct coff_filehdr *, 
 				     struct coff_aouthdr *));
-int exec_ibcs2_coff_setup_stack __P((struct proc *, struct exec_package *));
+int exec_ibcs2_coff_setup_stack __P((struct lwp *, struct exec_package *));
 void cpu_exec_ibcs2_coff_setup __P((int, struct proc *, struct exec_package *,
 				    void *));
 
-static int coff_load_shlib __P((struct proc *, const char *,
+static int coff_load_shlib __P((struct lwp *, const char *,
 		struct exec_package *));
-static int coff_find_section __P((struct proc *, struct vnode *, 
+static int coff_find_section __P((struct lwp *, struct vnode *, 
 				  struct coff_filehdr *, struct coff_scnhdr *,
 				  int));
 
@@ -93,8 +93,8 @@
  */
 
 int
-exec_ibcs2_coff_makecmds(p, epp)
-	struct proc *p;
+exec_ibcs2_coff_makecmds(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
 	int error;
@@ -114,13 +114,13 @@
 	ap = (void *)((char *)epp->ep_hdr + sizeof(struct coff_filehdr));
 	switch (ap->a_magic) {
 	case COFF_OMAGIC:
-		error = exec_ibcs2_coff_prep_omagic(p, epp, fp, ap);
+		error = exec_ibcs2_coff_prep_omagic(l, epp, fp, ap);
 		break;
 	case COFF_NMAGIC:
-		error = exec_ibcs2_coff_prep_nmagic(p, epp, fp, ap);
+		error = exec_ibcs2_coff_prep_nmagic(l, epp, fp, ap);
 		break;
 	case COFF_ZMAGIC:
-		error = exec_ibcs2_coff_prep_zmagic(p, epp, fp, ap);
+		error = exec_ibcs2_coff_prep_zmagic(l, epp, fp, ap);
 		break;
 	default:
 		return ENOEXEC;
@@ -146,10 +146,11 @@
  */
 
 int
-exec_ibcs2_coff_setup_stack(p, epp)
-	struct proc *p;
+exec_ibcs2_coff_setup_stack(l, epp)
+	struct lwp *l;
 	struct exec_package *epp;
 {
+	struct proc *p = l->l_proc;
 	/* DPRINTF(("enter exec_ibcs2_coff_setup_stack\n")); */
 
 	epp->ep_maxsaddr = USRSTACK - MAXSSIZ;
@@ -188,8 +189,8 @@
  */
 
 int
-exec_ibcs2_coff_prep_omagic(p, epp, fp, ap)
-	struct proc *p;
+exec_ibcs2_coff_prep_omagic(l, epp, fp, ap)
+	struct lwp *l;
 	struct exec_package *epp;
 	struct coff_filehdr *fp;
 	struct coff_aouthdr *ap;
@@ -231,7 +232,7 @@
 			epp->ep_tsize = epp->ep_daddr - epp->ep_taddr;
 	}
 	
-	return exec_ibcs2_coff_setup_stack(p, epp);
+	return exec_ibcs2_coff_setup_stack(l, epp);
 }
 
 /*
@@ -240,8 +241,8 @@
  */
 
 int
-exec_ibcs2_coff_prep_nmagic(p, epp, fp, ap)
-	struct proc *p;
+exec_ibcs2_coff_prep_nmagic(l, epp, fp, ap)
+	struct lwp *l;
 	struct exec_package *epp;
 	struct coff_filehdr *fp;
 	struct coff_aouthdr *ap;
@@ -360,7 +361,7 @@
 			epp->ep_tsize = epp->ep_daddr - epp->ep_taddr;
 	}
 
-	return exec_ibcs2_coff_setup_stack(p, epp);
+	return exec_ibcs2_coff_setup_stack(l, epp);
 }
 
 /*
@@ -370,8 +371,8 @@
  */
 
 static int
-coff_find_section(p, vp, fp, sh, s_type)
-	struct proc *p;
+coff_find_section(l, vp, fp, sh, s_type)
+	struct lwp *l;
 	struct vnode *vp;
 	struct coff_filehdr *fp;
 	struct coff_scnhdr *sh;
@@ -384,8 +385,8 @@
 	for (i = 0; i < fp->f_nscns; i++, pos += sizeof(struct coff_scnhdr)) {
 		siz = sizeof(struct coff_scnhdr);
 		error = vn_rdwr(UIO_READ, vp, (caddr_t) sh,
-		    siz, pos, UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred,
-		    &resid, p);
+		    siz, pos, UIO_SYSSPACE, IO_NODELOCKED, l->l_proc->p_ucred,
+		    &resid, l);
 		if (error) {
 			DPRINTF(("section hdr %d read error %d\n", i, error));
 			return error;
@@ -415,8 +416,8 @@
  */
 
 int
-exec_ibcs2_coff_prep_zmagic(p, epp, fp, ap)
-	struct proc *p;
+exec_ibcs2_coff_prep_zmagic(l, epp, fp, ap)
+	struct lwp *l;
 	struct exec_package *epp;
 	struct coff_filehdr *fp;
 	struct coff_aouthdr *ap;
@@ -429,7 +430,7 @@
 	/* DPRINTF(("enter exec_ibcs2_coff_prep_zmagic\n")); */
 
 	/* set up command for text segment */
-	error = coff_find_section(p, epp->ep_vp, fp, &sh, COFF_STYP_TEXT);
+	error = coff_find_section(l, epp->ep_vp, fp, &sh, COFF_STYP_TEXT);
 	if (error) {		
 		DPRINTF(("can't find text section: %d\n", error));
 		return error;
@@ -457,7 +458,7 @@
 #endif
 
 	/* set up command for data segment */
-	error = coff_find_section(p, epp->ep_vp, fp, &sh, COFF_STYP_DATA);
+	error = coff_find_section(l, epp->ep_vp, fp, &sh, COFF_STYP_DATA);
 	if (error) {
 		DPRINTF(("can't find data section: %d\n", error));
 		return error;
@@ -493,7 +494,7 @@
 	}
 
 	/* load any shared libraries */
-	error = coff_find_section(p, epp->ep_vp, fp, &sh, COFF_STYP_SHLIB);
+	error = coff_find_section(l, epp->ep_vp, fp, &sh, COFF_STYP_SHLIB);
 	if (!error) {
 		size_t resid;
 		struct coff_slhdr *slhdr;
@@ -514,8 +515,8 @@
 
 		error = vn_rdwr(UIO_READ, epp->ep_vp, (caddr_t) buf,
 				len, sh.s_scnptr,
-				UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred,
-				&resid, p);
+				UIO_SYSSPACE, IO_NODELOCKED, l->l_proc->p_ucred,
+				&resid, l);
 		if (error) {
 			DPRINTF(("shlib section read error %d\n", error));
 			free(buf, M_TEMP);
@@ -535,7 +536,7 @@
 			/* DPRINTF(("path_index: %d entry_len: %d name: %s\n",
 				 path_index, entry_len, slhdr->sl_name)); */
 
-			error = coff_load_shlib(p, slhdr->sl_name, epp);
+			error = coff_load_shlib(l, slhdr->sl_name, epp);
 			if (error) {
 				free(buf, M_TEMP);
 				return ENOEXEC;
@@ -566,29 +567,32 @@
 	}
 
 	
-	return exec_ibcs2_coff_setup_stack(p, epp);
+	return exec_ibcs2_coff_setup_stack(l, epp);
 }
 
 static int
-coff_load_shlib(p, path, epp)
-	struct proc *p;
+coff_load_shlib(l, path, epp)
+	struct lwp *l;
 	const char *path;
 	struct exec_package *epp;
 {
 	int error, siz;
 	int taddr, tsize, daddr, dsize, offset;
 	size_t resid;
+	struct proc *p;
 	struct nameidata nd;
 	struct coff_filehdr fh, *fhp = &fh;
 	struct coff_scnhdr sh, *shp = &sh;
 
+	p = l->l_proc;
+
 	/*
 	 * 1. open shlib file
 	 * 2. read filehdr
 	 * 3. map text, data, and bss out of it using VM_*
 	 */
-	CHECK_ALT_EXIST(p, NULL, path);	/* path is on kernel stack */
-	NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, p);
+	CHECK_ALT_EXIST(l, NULL, path);	/* path is on kernel stack */
+	NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, l);
 	/* first get the vnode */
 	if ((error = namei(&nd)) != 0) {
 		DPRINTF(("coff_load_shlib: can't find library %s\n", path));
@@ -597,7 +601,7 @@
 
 	siz = sizeof(struct coff_filehdr);
 	error = vn_rdwr(UIO_READ, nd.ni_vp, (caddr_t) fhp, siz, 0,
-	    UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, p);
+	    UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, l);
 	if (error) {
 	    DPRINTF(("filehdr read error %d\n", error));
 	    vrele(nd.ni_vp);
@@ -612,7 +616,7 @@
 	}
 
 	/* load text */
-	error = coff_find_section(p, nd.ni_vp, fhp, shp, COFF_STYP_TEXT);
+	error = coff_find_section(l, nd.ni_vp, fhp, shp, COFF_STYP_TEXT);
 	if (error) {
 	    DPRINTF(("can't find shlib text section\n"));
 	    vrele(nd.ni_vp);
@@ -629,7 +633,7 @@
 		  VM_PROT_READ|VM_PROT_EXECUTE);
 
 	/* load data */
-	error = coff_find_section(p, nd.ni_vp, fhp, shp, COFF_STYP_DATA);
+	error = coff_find_section(l, nd.ni_vp, fhp, shp, COFF_STYP_DATA);
 	if (error) {
 	    DPRINTF(("can't find shlib data section\n"));
 	    vre