+ const struct proc *p;
+{
+ register struct kinfo_proc *kp = (struct kinfo_proc *)p;
+ register int i;
+ register char *up;
+
+ if (kvminit == 0 && kvm_init(NULL, NULL, NULL, 0) == -1)
+ return (NULL);
+ if (p->p_stat == SZOMB) {
+ seterr("zombie process");
+ return (NULL);
+ }
+ /*
+ * Read u-area one page at a time for the benefit of post-mortems
+ */
+ up = (char *) p->p_addr;
+ for (i = 0; i < UPAGES; i++) {
+ if (klseek(kmem, (long)up, 0) == -1)
+ return (NULL);
+ if (read(kmem, user.upages[i], CLBYTES) != CLBYTES) {
+ seterr("cant read page %x of u of pid %d from %s",
+ up, p->p_pid, kmemf);
+ return(NULL);
+ }
+ up += CLBYTES;
+ }
+ pcbpf = (int) btop(p->p_addr); /* what should this be really? */
+ /*
+ * Conjure up a physical address for the arguments.
+ */
+ argaddr0 = argaddr1 = 0;
+#ifdef hp300
+ if (kp->kp_eproc.e_vm.vm_pmap.pm_ptab) {
+ struct pte pte[CLSIZE*2];
+
+ if (klseek(kmem,
+ (long)&kp->kp_eproc.e_vm.vm_pmap.pm_ptab
+ [btoc(USRSTACK-CLBYTES*2)], 0) == -1)
+ return (NULL);
+ if (read(kmem, (char *)&pte, sizeof(pte)) == sizeof(pte)) {
+#if CLBYTES < 2048
+ argaddr0 = ctob(pftoc(pte[CLSIZE*0].pg_pfnum));
+#endif
+ argaddr1 = ctob(pftoc(pte[CLSIZE*1].pg_pfnum));
+ }
+ }
+ kp->kp_eproc.e_vm.vm_rssize =
+ kp->kp_eproc.e_vm.vm_pmap.pm_stats.resident_count; /* XXX */
+#endif
+ return(&user.user);
+}
+#else
+struct user *
+kvm_getu(p)
+ const struct proc *p;