svn commit: r184803 - in user/imp/newcard/sys: . arm/arm arm/include arm/mv cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/dtrace cddl/contrib/opensola...

Warner Losh imp at FreeBSD.org
Sun Nov 9 12:36:14 PST 2008


Author: imp
Date: Sun Nov  9 20:36:13 2008
New Revision: 184803
URL: http://svn.freebsd.org/changeset/base/184803

Log:
  Merge.

Added:
  user/imp/newcard/sys/arm/arm/minidump_machdep.c
     - copied unchanged from r184779, head/sys/arm/arm/minidump_machdep.c
  user/imp/newcard/sys/arm/include/minidump.h
     - copied unchanged from r184779, head/sys/arm/include/minidump.h
  user/imp/newcard/sys/dev/mn/
     - copied from r184779, head/sys/dev/mn/
  user/imp/newcard/sys/dev/usb2/
     - copied from r184779, head/sys/dev/usb2/
  user/imp/newcard/sys/kgssapi/
     - copied from r184779, head/sys/kgssapi/
  user/imp/newcard/sys/modules/amr/amr_cam/
     - copied from r184779, head/sys/modules/amr/amr_cam/
  user/imp/newcard/sys/modules/kgssapi/
     - copied from r184779, head/sys/modules/kgssapi/
  user/imp/newcard/sys/modules/kgssapi_krb5/
     - copied from r184779, head/sys/modules/kgssapi_krb5/
  user/imp/newcard/sys/modules/usb2/
     - copied from r184779, head/sys/modules/usb2/
  user/imp/newcard/sys/nfsclient/nfs_krpc.c
     - copied unchanged from r184779, head/sys/nfsclient/nfs_krpc.c
  user/imp/newcard/sys/nfsserver/nfs_fha.c
     - copied unchanged from r184779, head/sys/nfsserver/nfs_fha.c
  user/imp/newcard/sys/nfsserver/nfs_fha.h
     - copied unchanged from r184779, head/sys/nfsserver/nfs_fha.h
  user/imp/newcard/sys/nfsserver/nfs_srvkrpc.c
     - copied unchanged from r184779, head/sys/nfsserver/nfs_srvkrpc.c
  user/imp/newcard/sys/rpc/replay.c
     - copied unchanged from r184779, head/sys/rpc/replay.c
  user/imp/newcard/sys/rpc/replay.h
     - copied unchanged from r184779, head/sys/rpc/replay.h
  user/imp/newcard/sys/rpc/rpcsec_gss/
     - copied from r184779, head/sys/rpc/rpcsec_gss/
  user/imp/newcard/sys/rpc/rpcsec_gss.h
     - copied unchanged from r184779, head/sys/rpc/rpcsec_gss.h
Deleted:
  user/imp/newcard/sys/pci/if_mn.c
Modified:
  user/imp/newcard/sys/   (props changed)
  user/imp/newcard/sys/arm/arm/dump_machdep.c
  user/imp/newcard/sys/arm/arm/pmap.c
  user/imp/newcard/sys/arm/include/md_var.h
  user/imp/newcard/sys/arm/include/pmap.h
  user/imp/newcard/sys/arm/mv/mv_machdep.c
  user/imp/newcard/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c
  user/imp/newcard/sys/cddl/compat/opensolaris/sys/types.h
  user/imp/newcard/sys/cddl/compat/opensolaris/sys/uio.h
  user/imp/newcard/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  user/imp/newcard/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
  user/imp/newcard/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
  user/imp/newcard/sys/cddl/dev/dtrace/dtrace_ioctl.c
  user/imp/newcard/sys/cddl/dev/dtrace/dtrace_load.c
  user/imp/newcard/sys/cddl/dev/dtrace/dtrace_unload.c
  user/imp/newcard/sys/cddl/dev/systrace/systrace.c
  user/imp/newcard/sys/compat/freebsd32/freebsd32_proto.h
  user/imp/newcard/sys/compat/freebsd32/freebsd32_syscall.h
  user/imp/newcard/sys/compat/freebsd32/freebsd32_syscalls.c
  user/imp/newcard/sys/compat/freebsd32/freebsd32_sysent.c
  user/imp/newcard/sys/compat/freebsd32/syscalls.master
  user/imp/newcard/sys/compat/linprocfs/linprocfs.c
  user/imp/newcard/sys/conf/NOTES
  user/imp/newcard/sys/conf/files
  user/imp/newcard/sys/conf/files.arm
  user/imp/newcard/sys/conf/kmod.mk
  user/imp/newcard/sys/conf/options
  user/imp/newcard/sys/dev/acpi_support/acpi_asus.c
  user/imp/newcard/sys/dev/acpica/Osd/OsdSchedule.c
  user/imp/newcard/sys/dev/acpica/acpi.c
  user/imp/newcard/sys/dev/adb/adb_mouse.c
  user/imp/newcard/sys/dev/age/if_age.c
  user/imp/newcard/sys/dev/amr/amr.c
  user/imp/newcard/sys/dev/amr/amr_cam.c
  user/imp/newcard/sys/dev/amr/amrvar.h
  user/imp/newcard/sys/dev/an/if_an.c
  user/imp/newcard/sys/dev/cardbus/cardbus_cis.c
  user/imp/newcard/sys/dev/cardbus/cardbusreg.h
  user/imp/newcard/sys/dev/cxgb/cxgb_main.c
  user/imp/newcard/sys/dev/cxgb/cxgb_osdep.h
  user/imp/newcard/sys/dev/e1000/if_em.c
  user/imp/newcard/sys/dev/e1000/if_igb.c
  user/imp/newcard/sys/dev/en/midway.c
  user/imp/newcard/sys/dev/hwpmc/hwpmc_mod.c
  user/imp/newcard/sys/dev/pci/pcireg.h
  user/imp/newcard/sys/dev/snp/snp.c
  user/imp/newcard/sys/dev/sound/pcm/channel.c
  user/imp/newcard/sys/dev/sound/pcm/channel.h
  user/imp/newcard/sys/dev/sound/pcm/mixer.c
  user/imp/newcard/sys/dev/sound/pcm/mixer.h
  user/imp/newcard/sys/dev/syscons/sysmouse.c
  user/imp/newcard/sys/dev/usb/u3g.c
  user/imp/newcard/sys/dev/usb/usb_subr.c
  user/imp/newcard/sys/dev/usb/usbdevs
  user/imp/newcard/sys/fs/coda/cnode.h
  user/imp/newcard/sys/fs/coda/coda_subr.c
  user/imp/newcard/sys/fs/coda/coda_venus.c
  user/imp/newcard/sys/fs/ntfs/ntfs_vnops.c
  user/imp/newcard/sys/fs/procfs/procfs.c
  user/imp/newcard/sys/fs/procfs/procfs_map.c
  user/imp/newcard/sys/fs/smbfs/smbfs_vfsops.c
  user/imp/newcard/sys/fs/unionfs/union_vfsops.c
  user/imp/newcard/sys/geom/journal/g_journal.c
  user/imp/newcard/sys/geom/part/g_part_apm.c
  user/imp/newcard/sys/geom/part/g_part_gpt.c
  user/imp/newcard/sys/gnu/fs/ext2fs/ext2_vfsops.c
  user/imp/newcard/sys/i386/conf/XEN
  user/imp/newcard/sys/i386/i386/bios.c
  user/imp/newcard/sys/isa/isa_common.c
  user/imp/newcard/sys/isa/isa_common.h
  user/imp/newcard/sys/isa/isavar.h
  user/imp/newcard/sys/isa/pnp.c
  user/imp/newcard/sys/kern/init_sysent.c
  user/imp/newcard/sys/kern/kern_cons.c   (props changed)
  user/imp/newcard/sys/kern/kern_descrip.c
  user/imp/newcard/sys/kern/kern_exec.c
  user/imp/newcard/sys/kern/kern_mbuf.c
  user/imp/newcard/sys/kern/kern_proc.c
  user/imp/newcard/sys/kern/kern_sig.c
  user/imp/newcard/sys/kern/kern_thr.c
  user/imp/newcard/sys/kern/kern_thread.c
  user/imp/newcard/sys/kern/sched_ule.c
  user/imp/newcard/sys/kern/subr_sleepqueue.c
  user/imp/newcard/sys/kern/subr_smp.c
  user/imp/newcard/sys/kern/sys_process.c
  user/imp/newcard/sys/kern/syscalls.c
  user/imp/newcard/sys/kern/syscalls.master
  user/imp/newcard/sys/kern/systrace_args.c
  user/imp/newcard/sys/kern/tty.c
  user/imp/newcard/sys/kern/tty_pts.c
  user/imp/newcard/sys/kern/vfs_export.c
  user/imp/newcard/sys/kern/vfs_lookup.c
  user/imp/newcard/sys/kern/vfs_mount.c
  user/imp/newcard/sys/kern/vfs_subr.c
  user/imp/newcard/sys/kern/vfs_syscalls.c
  user/imp/newcard/sys/kern/vfs_vnops.c
  user/imp/newcard/sys/mips/idt/if_kr.c
  user/imp/newcard/sys/modules/Makefile
  user/imp/newcard/sys/modules/amr/Makefile
  user/imp/newcard/sys/modules/krpc/Makefile
  user/imp/newcard/sys/modules/nfsclient/Makefile
  user/imp/newcard/sys/modules/nfsserver/Makefile
  user/imp/newcard/sys/modules/rl/Makefile
  user/imp/newcard/sys/modules/snp/Makefile
  user/imp/newcard/sys/modules/zfs/Makefile
  user/imp/newcard/sys/net/if.c
  user/imp/newcard/sys/net/if_arcsubr.c
  user/imp/newcard/sys/net/if_fddisubr.c
  user/imp/newcard/sys/net/if_fwsubr.c
  user/imp/newcard/sys/net/if_gif.c
  user/imp/newcard/sys/net/if_iso88025subr.c
  user/imp/newcard/sys/net/if_spppsubr.c
  user/imp/newcard/sys/net/if_tun.c
  user/imp/newcard/sys/net/radix_mpath.c
  user/imp/newcard/sys/netgraph/ng_tty.c
  user/imp/newcard/sys/netgraph/ng_tty.h
  user/imp/newcard/sys/netinet/tcp_input.c
  user/imp/newcard/sys/netinet/tcp_subr.c
  user/imp/newcard/sys/netinet/tcp_var.h
  user/imp/newcard/sys/netsmb/smb_conn.c
  user/imp/newcard/sys/netsmb/smb_conn.h
  user/imp/newcard/sys/netsmb/smb_dev.c
  user/imp/newcard/sys/nfsclient/nfs.h
  user/imp/newcard/sys/nfsclient/nfs_nfsiod.c
  user/imp/newcard/sys/nfsclient/nfs_socket.c
  user/imp/newcard/sys/nfsclient/nfs_subs.c
  user/imp/newcard/sys/nfsclient/nfs_vfsops.c
  user/imp/newcard/sys/nfsclient/nfsmount.h
  user/imp/newcard/sys/nfsserver/nfs.h
  user/imp/newcard/sys/nfsserver/nfs_serv.c
  user/imp/newcard/sys/nfsserver/nfs_srvcache.c
  user/imp/newcard/sys/nfsserver/nfs_srvsock.c
  user/imp/newcard/sys/nfsserver/nfs_srvsubs.c
  user/imp/newcard/sys/nfsserver/nfs_syscalls.c
  user/imp/newcard/sys/nfsserver/nfsm_subs.h
  user/imp/newcard/sys/nfsserver/nfsrvcache.h
  user/imp/newcard/sys/nlm/nlm.h
  user/imp/newcard/sys/nlm/nlm_advlock.c
  user/imp/newcard/sys/nlm/nlm_prot_impl.c
  user/imp/newcard/sys/nlm/nlm_prot_svc.c
  user/imp/newcard/sys/pci/if_rl.c
  user/imp/newcard/sys/pci/if_rlreg.h
  user/imp/newcard/sys/rpc/auth.h
  user/imp/newcard/sys/rpc/auth_none.c
  user/imp/newcard/sys/rpc/auth_unix.c
  user/imp/newcard/sys/rpc/clnt.h
  user/imp/newcard/sys/rpc/clnt_dg.c
  user/imp/newcard/sys/rpc/clnt_rc.c
  user/imp/newcard/sys/rpc/clnt_vc.c
  user/imp/newcard/sys/rpc/rpc_com.h
  user/imp/newcard/sys/rpc/rpc_generic.c
  user/imp/newcard/sys/rpc/rpc_msg.h
  user/imp/newcard/sys/rpc/rpc_prot.c
  user/imp/newcard/sys/rpc/svc.c
  user/imp/newcard/sys/rpc/svc.h
  user/imp/newcard/sys/rpc/svc_auth.c
  user/imp/newcard/sys/rpc/svc_auth.h
  user/imp/newcard/sys/rpc/svc_auth_unix.c
  user/imp/newcard/sys/rpc/svc_dg.c
  user/imp/newcard/sys/rpc/svc_generic.c
  user/imp/newcard/sys/rpc/svc_vc.c
  user/imp/newcard/sys/rpc/xdr.h
  user/imp/newcard/sys/security/audit/audit_arg.c
  user/imp/newcard/sys/security/audit/audit_bsm_klib.c
  user/imp/newcard/sys/security/audit/audit_pipe.c
  user/imp/newcard/sys/sys/cfictl.h
  user/imp/newcard/sys/sys/mount.h
  user/imp/newcard/sys/sys/param.h
  user/imp/newcard/sys/sys/proc.h
  user/imp/newcard/sys/sys/syscall.h
  user/imp/newcard/sys/sys/syscall.mk
  user/imp/newcard/sys/sys/sysent.h
  user/imp/newcard/sys/sys/sysproto.h
  user/imp/newcard/sys/sys/ttydefaults.h
  user/imp/newcard/sys/tools/vnode_if.awk
  user/imp/newcard/sys/ufs/ffs/ffs_softdep.c
  user/imp/newcard/sys/ufs/ufs/ufs_acl.c
  user/imp/newcard/sys/ufs/ufs/ufs_dirhash.c
  user/imp/newcard/sys/ufs/ufs/ufs_vfsops.c
  user/imp/newcard/sys/vm/uma.h
  user/imp/newcard/sys/vm/vm_page.c
  user/imp/newcard/sys/xdr/xdr_mbuf.c

Modified: user/imp/newcard/sys/arm/arm/dump_machdep.c
==============================================================================
--- user/imp/newcard/sys/arm/arm/dump_machdep.c	Sun Nov  9 17:37:54 2008	(r184802)
+++ user/imp/newcard/sys/arm/arm/dump_machdep.c	Sun Nov  9 20:36:13 2008	(r184803)
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/systm.h>
 #include <sys/conf.h>
 #include <sys/cons.h>
+#include <sys/sysctl.h>
 #include <sys/kernel.h>
 #include <sys/proc.h>
 #include <sys/kerneldump.h>
@@ -44,6 +45,11 @@ __FBSDID("$FreeBSD$");
 
 CTASSERT(sizeof(struct kerneldumpheader) == 512);
 
+int do_minidump = 1;
+TUNABLE_INT("debug.minidump", &do_minidump);
+SYSCTL_INT(_debug, OID_AUTO, minidump, CTLFLAG_RW, &do_minidump, 0,
+    "Enable mini crash dumps");
+
 /*
  * Don't touch the first SIZEOF_METADATA bytes on the dump device. This
  * is to protect us from metadata and to protect metadata from us.
@@ -155,11 +161,10 @@ cb_dumpdata(struct md_pa *mdp, int seqnr
 	vm_offset_t va;
 	uint32_t pgs;
 	size_t counter, sz, chunk;
-	int c, error, twiddle;
+	int c, error;
 
 	error = 0;	/* catch case in which chunk size is 0 */
-	counter = 0;	/* Update twiddle every 16MB */
-	twiddle = 0;
+	counter = 0;
 	va = 0;
 	pgs = mdp->md_size / PAGE_SIZE;
 	pa = mdp->md_start;
@@ -264,7 +269,12 @@ dumpsys(struct dumperinfo *di)
 	off_t hdrgap;
 	size_t hdrsz;
 	int error;
-	
+
+	if (do_minidump) {
+		minidumpsys(di);
+		return;
+	}
+
 	bzero(&ehdr, sizeof(ehdr));
 	ehdr.e_ident[EI_MAG0] = ELFMAG0;
 	ehdr.e_ident[EI_MAG1] = ELFMAG1;

Copied: user/imp/newcard/sys/arm/arm/minidump_machdep.c (from r184779, head/sys/arm/arm/minidump_machdep.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/imp/newcard/sys/arm/arm/minidump_machdep.c	Sun Nov  9 20:36:13 2008	(r184803, copy of r184779, head/sys/arm/arm/minidump_machdep.c)
@@ -0,0 +1,483 @@
+/*-
+ * Copyright (c) 2008 Semihalf, Grzegorz Bernacki
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *
+ * from: FreeBSD: src/sys/i386/i386/minidump_machdep.c,v 1.6 2008/08/17 23:27:27
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/cons.h>
+#include <sys/kernel.h>
+#include <sys/kerneldump.h>
+#include <sys/msgbuf.h>
+#include <sys/vimage.h>
+#include <vm/vm.h>
+#include <vm/pmap.h>
+#include <machine/pmap.h>
+#include <machine/atomic.h>
+#include <machine/elf.h>
+#include <machine/md_var.h>
+#include <machine/vmparam.h>
+#include <machine/minidump.h>
+#include <machine/cpufunc.h>
+
+CTASSERT(sizeof(struct kerneldumpheader) == 512);
+
+/*
+ * Don't touch the first SIZEOF_METADATA bytes on the dump device. This
+ * is to protect us from metadata and to protect metadata from us.
+ */
+#define	SIZEOF_METADATA		(64*1024)
+
+uint32_t *vm_page_dump;
+int vm_page_dump_size;
+
+static struct kerneldumpheader kdh;
+static off_t dumplo;
+
+/* Handle chunked writes. */
+static size_t fragsz, offset;
+static void *dump_va;
+static uint64_t counter, progress;
+
+CTASSERT(sizeof(*vm_page_dump) == 4);
+
+static int
+is_dumpable(vm_paddr_t pa)
+{
+	int i;
+
+	for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) {
+		if (pa >= dump_avail[i] && pa < dump_avail[i + 1])
+			return (1);
+	}
+	return (0);
+}
+
+#define PG2MB(pgs) (((pgs) + (1 << 8) - 1) >> 8)
+
+static int
+blk_flush(struct dumperinfo *di)
+{
+	int error;
+
+	if (fragsz == 0)
+		return (0);
+
+	error = dump_write(di, (char*)dump_va + offset, 0, dumplo, fragsz - offset);
+	dumplo += (fragsz - offset);
+	fragsz = 0;
+	offset = 0;
+	return (error);
+}
+
+static int
+blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t pa, size_t sz)
+{
+	size_t len;
+	int error, i, c;
+	u_int maxdumpsz;
+
+	maxdumpsz = di->maxiosize;
+
+	if (maxdumpsz == 0)	/* seatbelt */
+		maxdumpsz = PAGE_SIZE;
+
+	error = 0;
+
+	if (ptr != NULL && pa != 0) {
+		printf("cant have both va and pa!\n");
+		return (EINVAL);
+	}
+
+	if (ptr != NULL) {
+		/* If we're doing a virtual dump, flush any pre-existing pa pages */
+		error = blk_flush(di);
+		if (error)
+			return (error);
+	}
+
+	while (sz) {
+		if (fragsz == 0) {
+			offset = pa & PAGE_MASK;
+			fragsz += offset;
+		}
+		len = maxdumpsz - fragsz;
+		if (len > sz)
+			len = sz;
+		counter += len;
+		progress -= len;
+
+		if (counter >> 22) {
+			printf(" %lld", PG2MB(progress >> PAGE_SHIFT));
+			counter &= (1<<22) - 1;
+		}
+
+		if (ptr) {
+			error = dump_write(di, ptr, 0, dumplo, len);
+			if (error)
+				return (error);
+			dumplo += len;
+			ptr += len;
+			sz -= len;
+		} else {
+			for (i = 0; i < len; i += PAGE_SIZE)
+				dump_va = pmap_kenter_temp(pa + i,
+				    (i + fragsz) >> PAGE_SHIFT);
+			fragsz += len;
+			pa += len;
+			sz -= len;
+			if (fragsz == maxdumpsz) {
+				error = blk_flush(di);
+				if (error)
+					return (error);
+			}
+		}
+
+		/* Check for user abort. */
+		c = cncheckc();
+		if (c == 0x03)
+			return (ECANCELED);
+		if (c != -1)
+			printf(" (CTRL-C to abort) ");
+	}
+
+	return (0);
+}
+
+static int
+blk_write_cont(struct dumperinfo *di, vm_paddr_t pa, size_t sz)
+{
+	int error;
+
+	error = blk_write(di, 0, pa, sz);
+	if (error)
+		return (error);
+
+	error = blk_flush(di);
+	if (error)
+		return (error);
+
+	return (0);
+}
+
+/* A fake page table page, to avoid having to handle both 4K and 2M pages */
+static pt_entry_t fakept[NPTEPG];
+
+void
+minidumpsys(struct dumperinfo *di)
+{
+	struct minidumphdr mdhdr;
+	uint64_t dumpsize;
+	uint32_t ptesize;
+	uint32_t bits;
+	uint32_t pa, prev_pa = 0, count = 0;
+	vm_offset_t va;
+	pd_entry_t *pdp;
+	pt_entry_t *pt, *ptp;
+	int i, k, bit, error;
+	char *addr;
+
+	/* Flush cache */
+	cpu_idcache_wbinv_all();
+	cpu_l2cache_wbinv_all();
+
+	counter = 0;
+	/* Walk page table pages, set bits in vm_page_dump */
+	ptesize = 0;
+	for (va = KERNBASE; va < kernel_vm_end; va += NBPDR) {
+		/*
+		 * We always write a page, even if it is zero. Each
+		 * page written corresponds to 2MB of space
+		 */
+		ptesize += L2_TABLE_SIZE_REAL;
+		pmap_get_pde_pte(pmap_kernel(), va, &pdp, &ptp);
+		if (pmap_pde_v(pdp) && pmap_pde_section(pdp)) {
+			/* This is a section mapping 1M page. */
+			pa = (*pdp & L1_S_ADDR_MASK) | (va & ~L1_S_ADDR_MASK);
+			for (k = 0; k < (L1_S_SIZE / PAGE_SIZE); k++) {
+				if (is_dumpable(pa))
+					dump_add_page(pa);
+				pa += PAGE_SIZE;
+			}
+			continue;
+		}
+		if (pmap_pde_v(pdp) && pmap_pde_page(pdp)) {
+			/* Set bit for each valid page in this 1MB block */
+			addr = pmap_kenter_temp(*pdp & L1_C_ADDR_MASK, 0);
+			pt = (pt_entry_t*)(addr +
+			    (((uint32_t)*pdp  & L1_C_ADDR_MASK) & PAGE_MASK));
+			for (k = 0; k < 256; k++) {
+				if ((pt[k] & L2_TYPE_MASK) == L2_TYPE_L) {
+					pa = (pt[k] & L2_L_FRAME) |
+					    (va & L2_L_OFFSET);
+					for (i = 0; i < 16; i++) {
+						if (is_dumpable(pa))
+							dump_add_page(pa);
+						k++;
+						pa += PAGE_SIZE;
+					}
+				} else if ((pt[k] & L2_TYPE_MASK) == L2_TYPE_S) {
+					pa = (pt[k] & L2_S_FRAME) |
+					    (va & L2_S_OFFSET);
+					if (is_dumpable(pa))
+						dump_add_page(pa);
+				}
+			}
+		} else {
+			/* Nothing, we're going to dump a null page */
+		}
+	}
+
+	/* Calculate dump size. */
+	dumpsize = ptesize;
+	dumpsize += round_page(msgbufp->msg_size);
+	dumpsize += round_page(vm_page_dump_size);
+
+	for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) {
+		bits = vm_page_dump[i];
+		while (bits) {
+			bit = ffs(bits) - 1;
+			pa = (((uint64_t)i * sizeof(*vm_page_dump) * NBBY) +
+			    bit) * PAGE_SIZE;
+			/* Clear out undumpable pages now if needed */
+			if (is_dumpable(pa))
+				dumpsize += PAGE_SIZE;
+			else
+				dump_drop_page(pa);
+			bits &= ~(1ul << bit);
+		}
+	}
+
+	dumpsize += PAGE_SIZE;
+
+	/* Determine dump offset on device. */
+	if (di->mediasize < SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2) {
+		error = ENOSPC;
+		goto fail;
+	}
+
+	dumplo = di->mediaoffset + di->mediasize - dumpsize;
+	dumplo -= sizeof(kdh) * 2;
+	progress = dumpsize;
+
+	/* Initialize mdhdr */
+	bzero(&mdhdr, sizeof(mdhdr));
+	strcpy(mdhdr.magic, MINIDUMP_MAGIC);
+	mdhdr.version = MINIDUMP_VERSION;
+	mdhdr.msgbufsize = msgbufp->msg_size;
+	mdhdr.bitmapsize = vm_page_dump_size;
+	mdhdr.ptesize = ptesize;
+	mdhdr.kernbase = KERNBASE;
+
+	mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_ARM_VERSION, dumpsize,
+	    di->blocksize);
+
+	printf("Physical memory: %u MB\n", ptoa((uintmax_t)physmem) / 1048576);
+	printf("Dumping %llu MB:", (long long)dumpsize >> 20);
+
+	/* Dump leader */
+	error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh));
+	if (error)
+		goto fail;
+	dumplo += sizeof(kdh);
+
+	/* Dump my header */
+	bzero(&fakept, sizeof(fakept));
+	bcopy(&mdhdr, &fakept, sizeof(mdhdr));
+	error = blk_write(di, (char *)&fakept, 0, PAGE_SIZE);
+	if (error)
+		goto fail;
+
+	/* Dump msgbuf up front */
+	error = blk_write(di, (char *)msgbufp->msg_ptr, 0, round_page(msgbufp->msg_size));
+	if (error)
+		goto fail;
+
+	/* Dump bitmap */
+	error = blk_write(di, (char *)vm_page_dump, 0,
+	    round_page(vm_page_dump_size));
+	if (error)
+		goto fail;
+
+	/* Dump kernel page table pages */
+	for (va = KERNBASE; va < kernel_vm_end; va += NBPDR) {
+		/* We always write a page, even if it is zero */
+		pmap_get_pde_pte(pmap_kernel(), va, &pdp, &ptp);
+
+		if (pmap_pde_v(pdp) && pmap_pde_section(pdp))  {
+			if (count) {
+				error = blk_write_cont(di, prev_pa,
+				    count * L2_TABLE_SIZE_REAL);
+				if (error)
+					goto fail;
+				count = 0;
+				prev_pa = 0;
+			}
+			/* This is a single 2M block. Generate a fake PTP */
+			pa = (*pdp & L1_S_ADDR_MASK) | (va & ~L1_S_ADDR_MASK);
+			for (k = 0; k < (L1_S_SIZE / PAGE_SIZE); k++) {
+				fakept[k] = L2_S_PROTO | (pa + (k * PAGE_SIZE)) |
+				    L2_S_PROT(PTE_KERNEL,
+				    VM_PROT_READ | VM_PROT_WRITE);
+			}
+			error = blk_write(di, (char *)&fakept, 0,
+			    L2_TABLE_SIZE_REAL);
+			if (error)
+				goto fail;
+			/* Flush, in case we reuse fakept in the same block */
+			error = blk_flush(di);
+			if (error)
+				goto fail;
+			continue;
+		}
+		if (pmap_pde_v(pdp) && pmap_pde_page(pdp)) {
+			pa = *pdp & L1_C_ADDR_MASK;
+			if (!count) {
+				prev_pa = pa;
+				count++;
+			}
+			else {
+				if (pa == (prev_pa + count * L2_TABLE_SIZE_REAL))
+					count++;
+				else {
+					error = blk_write_cont(di, prev_pa,
+					    count * L2_TABLE_SIZE_REAL);
+					if (error)
+						goto fail;
+					count = 1;
+					prev_pa = pa;
+				}
+			}
+		} else {
+			if (count) {
+				error = blk_write_cont(di, prev_pa,
+				    count * L2_TABLE_SIZE_REAL);
+				if (error)
+					goto fail;
+				count = 0;
+				prev_pa = 0;
+			}
+			bzero(fakept, sizeof(fakept));
+			error = blk_write(di, (char *)&fakept, 0,
+			    L2_TABLE_SIZE_REAL);
+			if (error)
+				goto fail;
+			/* Flush, in case we reuse fakept in the same block */
+			error = blk_flush(di);
+			if (error)
+				goto fail;
+		}
+	}
+
+	if (count) {
+		error = blk_write_cont(di, prev_pa, count * L2_TABLE_SIZE_REAL);
+		if (error)
+			goto fail;
+		count = 0;
+		prev_pa = 0;
+	}
+
+	/* Dump memory chunks */
+	for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) {
+		bits = vm_page_dump[i];
+		while (bits) {
+			bit = ffs(bits) - 1;
+			pa = (((uint64_t)i * sizeof(*vm_page_dump) * NBBY) +
+			    bit) * PAGE_SIZE;
+			if (!count) {
+				prev_pa = pa;
+				count++;
+			} else {
+				if (pa == (prev_pa + count * PAGE_SIZE))
+					count++;
+				else {
+					error = blk_write_cont(di, prev_pa,
+					    count * PAGE_SIZE);
+					if (error)
+						goto fail;
+					count = 1;
+					prev_pa = pa;
+				}
+			}
+			bits &= ~(1ul << bit);
+		}
+	}
+	if (count) {
+		error = blk_write_cont(di, prev_pa, count * PAGE_SIZE);
+		if (error)
+			goto fail;
+		count = 0;
+		prev_pa = 0;
+	}
+
+	/* Dump trailer */
+	error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh));
+	if (error)
+		goto fail;
+	dumplo += sizeof(kdh);
+
+	/* Signal completion, signoff and exit stage left. */
+	dump_write(di, NULL, 0, 0, 0);
+	printf("\nDump complete\n");
+	return;
+
+fail:
+	if (error < 0)
+		error = -error;
+
+	if (error == ECANCELED)
+		printf("\nDump aborted\n");
+	else if (error == ENOSPC)
+		printf("\nDump failed. Partition too small.\n");
+	else
+		printf("\n** DUMP FAILED (ERROR %d) **\n", error);
+}
+
+void
+dump_add_page(vm_paddr_t pa)
+{
+	int idx, bit;
+
+	pa >>= PAGE_SHIFT;
+	idx = pa >> 5;		/* 2^5 = 32 */
+	bit = pa & 31;
+	atomic_set_int(&vm_page_dump[idx], 1ul << bit);
+}
+
+void
+dump_drop_page(vm_paddr_t pa)
+{
+	int idx, bit;
+
+	pa >>= PAGE_SHIFT;
+	idx = pa >> 5;		/* 2^5 = 32 */
+	bit = pa & 31;
+	atomic_clear_int(&vm_page_dump[idx], 1ul << bit);
+}

Modified: user/imp/newcard/sys/arm/arm/pmap.c
==============================================================================
--- user/imp/newcard/sys/arm/arm/pmap.c	Sun Nov  9 17:37:54 2008	(r184802)
+++ user/imp/newcard/sys/arm/arm/pmap.c	Sun Nov  9 20:36:13 2008	(r184803)
@@ -270,6 +270,11 @@ union pmap_cache_state *pmap_cache_state
 
 struct msgbuf *msgbufp = 0;
 
+/*
+ * Crashdump maps.
+ */
+static caddr_t crashdumpmap;
+
 extern void bcopy_page(vm_offset_t, vm_offset_t);
 extern void bzero_page(vm_offset_t);
 
@@ -1209,7 +1214,7 @@ pmap_l2cache_wbinv_range(pmap_t pm, vm_o
 		CTR4(KTR_PMAP, "pmap_l2cache_wbinv_range: pmap %p is_kernel %d "
 		    "va 0x%08x len 0x%x ", pm, pm == pmap_kernel(), va, rest);
 		if (pmap_get_pde_pte(pm, va, &pde, &ptep) && l2pte_valid(*ptep))
-		    cpu_l2cache_wb_range(va, rest);
+			cpu_l2cache_wb_range(va, rest);
 
 		len -= rest;
 		va += rest;
@@ -1241,7 +1246,7 @@ pmap_l2cache_wb_range(pmap_t pm, vm_offs
 		CTR4(KTR_PMAP, "pmap_l2cache_wb_range: pmap %p is_kernel %d "
 		    "va 0x%08x len 0x%x ", pm, pm == pmap_kernel(), va, rest);
 		if (pmap_get_pde_pte(pm, va, &pde, &ptep) && l2pte_valid(*ptep))
-		    cpu_l2cache_wb_range(va, rest);
+			cpu_l2cache_wb_range(va, rest);
 
 		len -= rest;
 		va += rest;
@@ -1276,6 +1281,7 @@ static PMAP_INLINE void
 pmap_dcache_wb_range(pmap_t pm, vm_offset_t va, vm_size_t len, boolean_t do_inv,
     boolean_t rd_only)
 {
+
 	CTR4(KTR_PMAP, "pmap_dcache_wb_range: pmap %p is_kernel %d va 0x%08x "
 	    "len 0x%x ", pm, pm == pmap_kernel(), va, len);
 	CTR2(KTR_PMAP, " do_inv %d rd_only %d", do_inv, rd_only);
@@ -1290,8 +1296,7 @@ pmap_dcache_wb_range(pmap_t pm, vm_offse
 				cpu_dcache_wbinv_range(va, len);
 				pmap_l2cache_wbinv_range(pm, va, len);
 			}
-		} else
-		if (!rd_only) {
+		} else if (!rd_only) {
 			cpu_dcache_wb_range(va, len);
 			pmap_l2cache_wb_range(pm, va, len);
 		}
@@ -2455,6 +2460,8 @@ pmap_bootstrap(vm_offset_t firstaddr, vm
 
 	pmap_alloc_specials(&virtual_avail,
 	    1, (vm_offset_t*)&_tmppt, NULL);
+	pmap_alloc_specials(&virtual_avail,
+	    MAXDUMPPGS, (vm_offset_t *)&crashdumpmap, NULL);
 	SLIST_INIT(&l1_list);
 	TAILQ_INIT(&l1_lru_list);
 	mtx_init(&l1_lru_lock, "l1 list lock", NULL, MTX_DEF);
@@ -2793,6 +2800,20 @@ pmap_kenter_section(vm_offset_t va, vm_o
 }
 
 /*
+ * Make a temporary mapping for a physical address.  This is only intended
+ * to be used for panic dumps.
+ */
+void *
+pmap_kenter_temp(vm_paddr_t pa, int i)
+{
+	vm_offset_t va;
+
+	va = (vm_offset_t)crashdumpmap + (i * PAGE_SIZE);
+	pmap_kenter(va, pa);
+	return ((void *)crashdumpmap);
+}
+
+/*
  * add a wired page to the kva
  * note that in order for the mapping to take effect -- you
  * should do a invltlb after doing the pmap_kenter...
@@ -3958,7 +3979,7 @@ pmap_zero_page_generic(vm_paddr_t phys, 
 	 * Hook in the page, zero it, invalidate the TLB as needed.
 	 *
 	 * Note the temporary zero-page mapping must be a non-cached page in
-	 * ordert to work without corruption when write-allocate is enabled.
+	 * order to work without corruption when write-allocate is enabled.
 	 */
 	*cdst_pte = L2_S_PROTO | phys | L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE);
 	cpu_tlb_flushD_SE(cdstp);

Modified: user/imp/newcard/sys/arm/include/md_var.h
==============================================================================
--- user/imp/newcard/sys/arm/include/md_var.h	Sun Nov  9 17:37:54 2008	(r184802)
+++ user/imp/newcard/sys/arm/include/md_var.h	Sun Nov  9 20:36:13 2008	(r184803)
@@ -35,6 +35,8 @@
 
 extern char sigcode[];
 extern int szsigcode;
+extern uint32_t *vm_page_dump;
+extern int vm_page_dump_size;
 
 extern int (*_arm_memcpy)(void *, void *, int, int);
 extern int (*_arm_bzero)(void *, int, int);
@@ -46,7 +48,11 @@ extern int _min_bzero_size;
 #define SRC_IS_USER	0x2
 #define IS_PHYSICAL	0x4
 
+struct dumperinfo;
 extern int busdma_swi_pending;
 void busdma_swi(void);
+void dump_add_page(vm_paddr_t);
+void dump_drop_page(vm_paddr_t);
+void minidumpsys(struct dumperinfo *);
 
 #endif /* !_MACHINE_MD_VAR_H_ */

Copied: user/imp/newcard/sys/arm/include/minidump.h (from r184779, head/sys/arm/include/minidump.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/imp/newcard/sys/arm/include/minidump.h	Sun Nov  9 20:36:13 2008	(r184803, copy of r184779, head/sys/arm/include/minidump.h)
@@ -0,0 +1,45 @@
+/*-
+ * Copyright (c) 2006 Peter Wemm
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *
+ * From: FreeBSD: src/sys/i386/include/minidump.h,v 1.1 2006/04/21 04:28:43
+ * $FreeBSD$
+ */
+
+#ifndef	_MACHINE_MINIDUMP_H_
+#define	_MACHINE_MINIDUMP_H_ 1
+
+#define	MINIDUMP_MAGIC		"minidump FreeBSD/arm"
+#define	MINIDUMP_VERSION	1
+
+struct minidumphdr {
+	char magic[24];
+	uint32_t version;
+	uint32_t msgbufsize;
+	uint32_t bitmapsize;
+	uint32_t ptesize;
+	uint32_t kernbase;
+};
+
+#endif /* _MACHINE_MINIDUMP_H_ */

Modified: user/imp/newcard/sys/arm/include/pmap.h
==============================================================================
--- user/imp/newcard/sys/arm/include/pmap.h	Sun Nov  9 17:37:54 2008	(r184802)
+++ user/imp/newcard/sys/arm/include/pmap.h	Sun Nov  9 20:36:13 2008	(r184803)
@@ -206,6 +206,7 @@ extern vm_offset_t virtual_end;
 void	pmap_bootstrap(vm_offset_t, vm_offset_t, struct pv_addr *);
 void	pmap_kenter(vm_offset_t va, vm_paddr_t pa);
 void	pmap_kenter_nocache(vm_offset_t va, vm_paddr_t pa);
+void	*pmap_kenter_temp(vm_paddr_t pa, int i);
 void 	pmap_kenter_user(vm_offset_t va, vm_paddr_t pa);
 void	pmap_kremove(vm_offset_t);
 void	*pmap_mapdev(vm_offset_t, vm_size_t);

Modified: user/imp/newcard/sys/arm/mv/mv_machdep.c
==============================================================================
--- user/imp/newcard/sys/arm/mv/mv_machdep.c	Sun Nov  9 17:37:54 2008	(r184802)
+++ user/imp/newcard/sys/arm/mv/mv_machdep.c	Sun Nov  9 20:36:13 2008	(r184803)
@@ -93,9 +93,6 @@ __FBSDID("$FreeBSD$");
 #define debugf(fmt, args...)
 #endif
 
-#define KERNEL_PT_SYS	0	/* Page table for mapping proc0 zero page */
-#define KERNEL_PT_KERN	1
-
 /*
  * This is the number of L2 page tables required for covering max
  * (hypothetical) memsize of 4GB and all kernel mappings (vectors, msgbuf,
@@ -366,7 +363,7 @@ initarm(void *mdp, void *unused __unused
 	struct bi_mem_region *mr;
 	void *kmdp;
 	u_int l1pagetable;
-	int i = 0;
+	int i = 0, j = 0;
 
 	kmdp = NULL;
 	lastaddr = 0;
@@ -465,13 +462,14 @@ initarm(void *mdp, void *unused __unused
 		if (!(i % (PAGE_SIZE / L2_TABLE_SIZE_REAL))) {
 			valloc_pages(kernel_pt_table[i],
 			    L2_TABLE_SIZE / PAGE_SIZE);
+			j = i;
 		} else {
-			kernel_pt_table[i].pv_va = freemempos -
-			    (i % (PAGE_SIZE / L2_TABLE_SIZE_REAL)) *
-			    L2_TABLE_SIZE_REAL;
+			kernel_pt_table[i].pv_va = kernel_pt_table[j].pv_va +
+			    L2_TABLE_SIZE_REAL * (i - j);
 			kernel_pt_table[i].pv_pa =
 			    kernel_pt_table[i].pv_va - KERNVIRTADDR +
 			    KERNPHYSADDR;
+
 		}
 	}
 	/*
@@ -506,7 +504,7 @@ initarm(void *mdp, void *unused __unused
 	l2_start = lastaddr & ~(L1_S_OFFSET);
 	for (i = 0 ; i < l2size - 1; i++)
 		pmap_link_l2pt(l1pagetable, l2_start + i * L1_S_SIZE,
-		    &kernel_pt_table[KERNEL_PT_KERN + i]);
+		    &kernel_pt_table[i]);
 
 	pmap_curmaxkvaddr = l2_start + (l2size - 1) * L1_S_SIZE;
 	
@@ -532,7 +530,7 @@ initarm(void *mdp, void *unused __unused
 
 	/* Link and map the vector page */
 	pmap_link_l2pt(l1pagetable, ARM_VECTORS_HIGH,
-	    &kernel_pt_table[KERNEL_PT_SYS]);
+	    &kernel_pt_table[l2size - 1]);
 	pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa,
 	    VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
 
@@ -603,8 +601,8 @@ initarm(void *mdp, void *unused __unused
 
 	arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
 
-	dump_avail[0] = KERNPHYSADDR;
-	dump_avail[1] = KERNPHYSADDR + memsize;
+	dump_avail[0] = 0;
+	dump_avail[1] = memsize;
 	dump_avail[2] = 0;
 	dump_avail[3] = 0;
 

Modified: user/imp/newcard/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c
==============================================================================
--- user/imp/newcard/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c	Sun Nov  9 17:37:54 2008	(r184802)
+++ user/imp/newcard/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c	Sun Nov  9 20:36:13 2008	(r184803)
@@ -93,6 +93,10 @@ void
 zfs_kmem_free(void *buf, size_t size __unused)
 {
 #ifdef KMEM_DEBUG
+	if (buf == NULL) {
+		printf("%s: attempt to free NULL\n",__func__);
+		return;
+	}
 	struct kmem_item *i;
 
 	buf = (u_char *)buf - sizeof(struct kmem_item);
@@ -236,7 +240,8 @@ calloc(size_t n, size_t s)
 }
 
 #ifdef KMEM_DEBUG
-static void
+void kmem_show(void *);
+void
 kmem_show(void *dummy __unused)
 {
 	struct kmem_item *i;
@@ -248,12 +253,10 @@ kmem_show(void *dummy __unused)
 		printf("KMEM_DEBUG: Leaked elements:\n\n");
 		LIST_FOREACH(i, &kmem_items, next) {
 			printf("address=%p\n", i);
-			stack_print(&i->stack);
-			printf("\n");
 		}
 	}
 	mtx_unlock(&kmem_items_mtx);
 }
 
-SYSUNINIT(sol_kmem, SI_SUB_DRIVERS, SI_ORDER_FIRST, kmem_show, NULL);
+SYSUNINIT(sol_kmem, SI_SUB_CPU, SI_ORDER_FIRST, kmem_show, NULL);
 #endif	/* KMEM_DEBUG */

Modified: user/imp/newcard/sys/cddl/compat/opensolaris/sys/types.h
==============================================================================
--- user/imp/newcard/sys/cddl/compat/opensolaris/sys/types.h	Sun Nov  9 17:37:54 2008	(r184802)
+++ user/imp/newcard/sys/cddl/compat/opensolaris/sys/types.h	Sun Nov  9 20:36:13 2008	(r184803)
@@ -64,12 +64,13 @@ typedef	void		pathname_t;
 typedef	int64_t		rlim64_t;
 
 #else
-
+#ifdef NEED_SOLARIS_BOOLEAN
 #if defined(__XOPEN_OR_POSIX)
 typedef enum { _B_FALSE, _B_TRUE }	boolean_t;
 #else
 typedef enum { B_FALSE, B_TRUE }	boolean_t;
 #endif /* defined(__XOPEN_OR_POSIX) */
+#endif
 
 typedef	longlong_t	offset_t;
 typedef	u_longlong_t	u_offset_t;

Modified: user/imp/newcard/sys/cddl/compat/opensolaris/sys/uio.h
==============================================================================
--- user/imp/newcard/sys/cddl/compat/opensolaris/sys/uio.h	Sun Nov  9 17:37:54 2008	(r184802)
+++ user/imp/newcard/sys/cddl/compat/opensolaris/sys/uio.h	Sun Nov  9 20:36:13 2008	(r184803)
@@ -51,6 +51,7 @@ typedef	struct iovec	iovec_t;
 
 #define	uio_loffset	uio_offset
 
+#ifdef BUILDING_ZFS
 static __inline int
 zfs_uiomove(void *cp, size_t n, enum uio_rw dir, uio_t *uio)
 {
@@ -59,5 +60,6 @@ zfs_uiomove(void *cp, size_t n, enum uio
 	return (uiomove(cp, (int)n, uio));
 }
 #define	uiomove(cp, n, dir, uio)	zfs_uiomove((cp), (n), (dir), (uio))
+#endif
 
 #endif	/* !_OPENSOLARIS_SYS_UIO_H_ */

Modified: user/imp/newcard/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==============================================================================
--- user/imp/newcard/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Sun Nov  9 17:37:54 2008	(r184802)
+++ user/imp/newcard/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Sun Nov  9 20:36:13 2008	(r184803)
@@ -3007,6 +3007,9 @@ dtrace_dif_variable(dtrace_mstate_t *mst
 	case DIF_VAR_EXECARGS: {
 		struct pargs *p_args = curthread->td_proc->p_args;
 
+		if (p_args == NULL)
+			return(0);
+
 		return (dtrace_dif_varstrz(
 		    (uintptr_t) p_args->ar_args, p_args->ar_length, state, mstate));
 	}
@@ -10598,7 +10601,6 @@ dtrace_buffer_alloc(dtrace_buffer_t *buf
 		/*
 		 * If there is already a buffer allocated for this CPU, it
 		 * is only possible that this is a DR event.  In this case,
-		 * the buffer size must match our specified size.
 		 */
 		if (buf->dtb_tomax != NULL) {
 			ASSERT(buf->dtb_size == size);
@@ -12815,11 +12817,7 @@ dtrace_state_create(struct cdev *dev)
 	state = ddi_get_soft_state(dtrace_softstate, minor);
 #else
 	if (dev != NULL) {
-		/*
-		 * Disable this until we have the ability to set user
-		 * credentials for DTrace.
-		 * cr = dev->si_cred;
-		 */
+		cr = dev->si_cred;
 		m = dev2unit(dev);
 		}
 
@@ -15241,6 +15239,15 @@ dtrace_attach(dev_info_t *devi, ddi_atta
 }
 #endif
 
+#if !defined(sun)
+#if __FreeBSD_version >= 800039
+static void
+dtrace_dtr(void *data __unused)
+{
+}
+#endif
+#endif
+
 /*ARGSUSED*/
 static int
 #if defined(sun)
@@ -15266,6 +15273,7 @@ dtrace_open(struct cdev *dev, int oflags
 #else
 	cred_t *cred_p = NULL;
 
+#if __FreeBSD_version < 800039
 	/*
 	 * The first minor device is the one that is cloned so there is
 	 * nothing more to do here.
@@ -15281,6 +15289,7 @@ dtrace_open(struct cdev *dev, int oflags
 	 */
 	if (dev->si_drv1 != NULL)
 		return (EBUSY);
+#endif
 
 	cred_p = dev->si_cred;
 #endif
@@ -15292,9 +15301,11 @@ dtrace_open(struct cdev *dev, int oflags
 	dtrace_cred2priv(cred_p, &priv, &uid, &zoneid);
 	if (priv == DTRACE_PRIV_NONE) {
 #if !defined(sun)
+#if __FreeBSD_version < 800039
 		/* Destroy the cloned device. */
                 destroy_dev(dev);
 #endif
+#endif
 
 		return (EACCES);
 	}
@@ -15326,7 +15337,11 @@ dtrace_open(struct cdev *dev, int oflags
 	state = dtrace_state_create(devp, cred_p);
 #else
 	state = dtrace_state_create(dev);
+#if __FreeBSD_version < 800039
 	dev->si_drv1 = state;
+#else
+	devfs_set_cdevpriv(state, dtrace_dtr);
+#endif
 #endif
 
 	mutex_exit(&cpu_lock);
@@ -15340,9 +15355,11 @@ dtrace_open(struct cdev *dev, int oflags
 #endif
 		mutex_exit(&dtrace_lock);
 #if !defined(sun)
+#if __FreeBSD_version < 800039
 		/* Destroy the cloned device. */
                 destroy_dev(dev);
 #endif
+#endif
 		return (EAGAIN);
 	}
 
@@ -15368,11 +15385,16 @@ dtrace_close(struct cdev *dev, int flags
 
 	state = ddi_get_soft_state(dtrace_softstate, minor);
 #else
+#if __FreeBSD_version < 800039
 	dtrace_state_t *state = dev->si_drv1;
 
 	/* Check if this is not a cloned device. */
 	if (dev2unit(dev) == 0)
 		return (0);
+#else
+	dtrace_state_t *state;
+	devfs_get_cdevpriv((void **) &state);
+#endif
 
 #endif
 
@@ -15392,7 +15414,11 @@ dtrace_close(struct cdev *dev, int flags
 
 #if !defined(sun)
 		kmem_free(state, 0);
+#if __FreeBSD_version < 800039
 		dev->si_drv1 = NULL;
+#else
+		devfs_clear_cdevpriv();
+#endif
 #endif
 	}
 
@@ -15407,8 +15433,10 @@ dtrace_close(struct cdev *dev, int flags
 	mutex_exit(&dtrace_lock);
 	mutex_exit(&cpu_lock);
 
+#if __FreeBSD_version < 800039
 	/* Schedule this cloned device to be destroyed. */
 	destroy_dev_sched(dev);
+#endif
 
 	return (0);
 }
@@ -16442,16 +16470,20 @@ _fini(void)
 static d_ioctl_t	dtrace_ioctl;
 static void		dtrace_load(void *);
 static int		dtrace_unload(void);
+#if __FreeBSD_version < 800039
 static void		dtrace_clone(void *, struct ucred *, char *, int , struct cdev **);
 static struct clonedevs	*dtrace_clones;		/* Ptr to the array of cloned devices. */
 static eventhandler_tag	eh_tag;			/* Event handler tag. */
+#else
+static struct cdev	*dtrace_dev;
+#endif
 
 void dtrace_invop_init(void);
 void dtrace_invop_uninit(void);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-user mailing list