-/* $OpenBSD: vm_machdep.c,v 1.42 2014/11/16 12:30:52 deraadt Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.43 2015/05/05 02:13:46 guenther Exp $ */
/* $NetBSD: vm_machdep.c,v 1.55 2000/03/29 03:49:48 simonb Exp $ */
/*
#include <sys/buf.h>
#include <sys/vnode.h>
#include <sys/user.h>
-#include <sys/core.h>
#include <sys/exec.h>
#include <uvm/uvm_extern.h>
#include <machine/reg.h>
-/*
- * Dump the machine specific header information at the start of a core dump.
- */
-int
-cpu_coredump(p, vp, cred, chdr)
- struct proc *p;
- struct vnode *vp;
- struct ucred *cred;
- struct core *chdr;
-{
- int error;
- struct md_coredump cpustate;
- struct coreseg cseg;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_ALPHA, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof(cpustate);
-
- cpustate.md_tf = *p->p_md.md_tf;
- cpustate.md_tf.tf_regs[FRAME_SP] = alpha_pal_rdusp(); /* XXX */
- if (p->p_md.md_flags & MDP_FPUSED) {
- if (p->p_addr->u_pcb.pcb_fpcpu != NULL)
- fpusave_proc(p, 1);
- cpustate.md_fpstate = p->p_addr->u_pcb.pcb_fp;
- } else
- bzero(&cpustate.md_fpstate, sizeof(cpustate.md_fpstate));
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_ALPHA, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cpustate, sizeof(cpustate),
- (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE,
- IO_UNIT, cred, NULL, p);
-
- if (!error)
- chdr->c_nseg++;
-
- return error;
-}
-
/*
* cpu_exit is called as the last action during exit.
*/
-/* $OpenBSD: pcb.h,v 1.10 2014/03/29 18:09:28 guenther Exp $ */
+/* $OpenBSD: pcb.h,v 1.11 2015/05/05 02:13:46 guenther Exp $ */
/* $NetBSD: pcb.h,v 1.5 1996/11/13 22:21:00 cgd Exp $ */
/*
struct cpu_info *volatile pcb_fpcpu; /* CPU with our FP state[SW] */
};
-/*
- * The pcb is augmented with machine-dependent additional data for
- * core dumps. For the Alpha, that's a trap frame and the floating
- * point registers.
- */
-struct md_coredump {
- struct trapframe md_tf;
- struct fpreg md_fpstate;
-};
-
#ifdef _KERNEL
void savectx(struct pcb *);
#endif
-/* $OpenBSD: hibernate_machdep.c,v 1.36 2015/03/14 03:38:46 jsg Exp $ */
+/* $OpenBSD: hibernate_machdep.c,v 1.37 2015/05/05 02:13:46 guenther Exp $ */
/*
* Copyright (c) 2012 Mike Larkin <mlarkin@openbsd.org>
#include <machine/cpu.h>
#include <machine/hibernate_var.h>
-#include <machine/kcore.h>
#include <machine/pte.h>
#include <machine/pmap.h>
-/* $OpenBSD: vm_machdep.c,v 1.30 2015/03/14 03:38:46 jsg Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.31 2015/05/05 02:13:46 guenther Exp $ */
/* $NetBSD: vm_machdep.c,v 1.1 2003/04/26 18:39:33 fvdl Exp $ */
/*-
#include <sys/vnode.h>
#include <sys/buf.h>
#include <sys/user.h>
-#include <sys/core.h>
#include <sys/exec.h>
#include <sys/ptrace.h>
#include <sys/signalvar.h>
sched_exit(p);
}
-/*
- * Dump the machine specific segment at the start of a core dump.
- */
-struct md_core {
- struct reg intreg;
- struct fpreg freg;
-};
-
-int
-cpu_coredump(struct proc *p, struct vnode *vp, struct ucred *cred,
- struct core *chdr)
-{
- struct md_core md_core;
- struct coreseg cseg;
- int error;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_MACHINE, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof(md_core);
-
- /* Save integer registers. */
- error = process_read_regs(p, &md_core.intreg);
- if (error)
- return error;
-
- /* Save floating point registers. */
- error = process_read_fpregs(p, &md_core.freg);
- if (error)
- return error;
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_MACHINE, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
- 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_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- chdr->c_nseg++;
- return 0;
-}
-
/*
* Set a red zone in the kernel stack after the u. area.
*/
-/* $OpenBSD: pcb.h,v 1.12 2011/07/10 18:12:03 deraadt Exp $ */
+/* $OpenBSD: pcb.h,v 1.13 2015/05/05 02:13:46 guenther Exp $ */
/* $NetBSD: pcb.h,v 1.1 2003/04/26 18:39:45 fvdl Exp $ */
/*-
int pcb_cr0; /* saved image of CR0 */
};
-/*
- * The pcb is augmented with machine-dependent additional data for
- * core dumps. For the i386, there is nothing to add.
- */
-struct md_coredump {
- long md_pad[8];
-};
-
#endif /* _MACHINE_PCB_H_ */
-/* $OpenBSD: vm_machdep.c,v 1.14 2014/11/16 12:30:56 deraadt Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.15 2015/05/05 02:13:46 guenther Exp $ */
/* $NetBSD: vm_machdep.c,v 1.31 2004/01/04 11:33:29 jdolecek Exp $ */
/*
#include <sys/vnode.h>
#include <sys/buf.h>
#include <sys/user.h>
-#include <sys/core.h>
#include <sys/exec.h>
#include <sys/ptrace.h>
sched_exit(p);
}
-/*
- * Dump the machine specific segment at the start of a core dump.
- */
-
-int
-cpu_coredump(struct proc *p, struct vnode *vp, struct ucred *cred,
- struct core *chdr)
-{
- int error;
- struct {
- struct reg regs;
- struct fpreg fpregs;
- } cpustate;
- struct coreseg cseg;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_MACHINE, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof(cpustate);
-
- /* Save integer registers. */
- error = process_read_regs(p, &cpustate.regs);
- if (error)
- return error;
- /* Save floating point registers. */
- error = process_read_fpregs(p, &cpustate.fpregs);
- if (error)
- return error;
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_MACHINE, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cpustate, sizeof(cpustate),
- (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE,
- IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- chdr->c_nseg++;
-
- return error;
-}
-
/*
* Map a user I/O request into kernel virtual address space.
* Note: the pages are already locked by uvm_vslock(), so we
-/* $OpenBSD: pcb.h,v 1.5 2013/09/12 11:43:51 patrick Exp $ */
+/* $OpenBSD: pcb.h,v 1.6 2015/05/05 02:13:46 guenther Exp $ */
/* $NetBSD: pcb.h,v 1.10 2003/10/13 21:46:39 scw Exp $ */
/*
struct fpe_sp_state pcb_fpstate; /* Floating Point state */
};
-/*
- * No additional data for core dumps.
- */
-struct md_coredump {
- int md_empty;
-};
-
#endif /* _ARM_PCB_H_ */
-/* $OpenBSD: armish_machdep.c,v 1.36 2015/01/18 10:17:42 jsg Exp $ */
+/* $OpenBSD: armish_machdep.c,v 1.37 2015/05/05 02:13:46 guenther Exp $ */
/* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */
/*
#include <sys/msgbuf.h>
#include <sys/reboot.h>
#include <sys/termios.h>
-#include <sys/kcore.h>
#include <uvm/uvm_extern.h>
-/* $OpenBSD: vm_machdep.c,v 1.80 2014/12/16 18:30:03 tedu Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.81 2015/05/05 02:13:46 guenther Exp $ */
/*
* Copyright (c) 1999-2004 Michael Shalayeff
#include <sys/user.h>
#include <sys/ptrace.h>
#include <sys/exec.h>
-#include <sys/core.h>
#include <sys/pool.h>
#include <uvm/uvm_extern.h>
extern struct pool hppa_fppl;
-/*
- * Dump the machine specific header information at the start of a core dump.
- */
-int
-cpu_coredump(struct proc *p, struct vnode *vp, struct ucred *cred,
- struct core *core)
-{
- struct md_coredump md_core;
- struct coreseg cseg;
- off_t off;
- int error;
-
- CORE_SETMAGIC(*core, COREMAGIC, MID_HPPA, 0);
- core->c_hdrsize = ALIGN(sizeof(*core));
- core->c_seghdrsize = ALIGN(sizeof(cseg));
- core->c_cpusize = sizeof(md_core);
-
- process_read_regs(p, &md_core.md_reg);
- process_read_fpregs(p, &md_core.md_fpreg);
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_HPPA, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = core->c_cpusize;
-
-#define write(vp, addr, n) \
- vn_rdwr(UIO_WRITE, (vp), (caddr_t)(addr), (n), off, \
- UIO_SYSSPACE, IO_UNIT, cred, NULL, p)
-
- off = core->c_hdrsize;
- if ((error = write(vp, &cseg, core->c_seghdrsize)))
- return error;
- off += core->c_seghdrsize;
- if ((error = write(vp, &md_core, sizeof md_core)))
- return error;
-
-#undef write
- core->c_nseg++;
-
- return error;
-}
-
void
cpu_fork(struct proc *p1, struct proc *p2, void *stack, size_t stacksize,
void (*func)(void *), void *arg)
-/* $OpenBSD: pcb.h,v 1.15 2011/11/10 22:48:13 deraadt Exp $ */
+/* $OpenBSD: pcb.h,v 1.16 2015/05/05 02:13:46 guenther Exp $ */
/*
* Copyright (c) 1999-2004 Michael Shalayeff
pa_space_t pcb_space; /* copy pmap_space, for asm's sake */
};
-struct md_coredump {
- struct reg md_reg;
- struct fpreg md_fpreg;
-};
-
-
#endif /* _MACHINE_PCB_H_ */
-/* $OpenBSD: vm_machdep.c,v 1.21 2014/11/16 12:30:57 deraadt Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.22 2015/05/05 02:13:46 guenther Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
#include <sys/user.h>
#include <sys/ptrace.h>
#include <sys/exec.h>
-#include <sys/core.h>
#include <sys/pool.h>
#include <uvm/uvm_extern.h>
extern struct pool hppa_fppl;
-/*
- * Dump the machine specific header information at the start of a core dump.
- */
-int
-cpu_coredump(struct proc *p, struct vnode *vp, struct ucred *cred,
- struct core *core)
-{
- struct md_coredump md_core;
- struct coreseg cseg;
- off_t off;
- int error;
-
- CORE_SETMAGIC(*core, COREMAGIC, MID_HPPA20, 0);
- core->c_hdrsize = ALIGN(sizeof(*core));
- core->c_seghdrsize = ALIGN(sizeof(cseg));
- core->c_cpusize = sizeof(md_core);
-
- process_read_regs(p, &md_core.md_reg);
- process_read_fpregs(p, &md_core.md_fpreg);
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_HPPA20, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = core->c_cpusize;
-
-#define write(vp, addr, n) \
- vn_rdwr(UIO_WRITE, (vp), (caddr_t)(addr), (n), off, \
- UIO_SYSSPACE, IO_UNIT, cred, NULL, p)
-
- off = core->c_hdrsize;
- if ((error = write(vp, &cseg, core->c_seghdrsize)))
- return error;
- off += core->c_seghdrsize;
- if ((error = write(vp, &md_core, sizeof md_core)))
- return error;
-
-#undef write
- core->c_nseg++;
-
- return error;
-}
-
void
cpu_fork(struct proc *p1, struct proc *p2, void *stack, size_t stacksize,
void (*func)(void *), void *arg)
-/* $OpenBSD: pcb.h,v 1.4 2011/11/10 23:15:11 deraadt Exp $ */
+/* $OpenBSD: pcb.h,v 1.5 2015/05/05 02:13:46 guenther Exp $ */
/*
* Copyright (c) 2005 Michael Shalayeff
pa_space_t pcb_space; /* copy pmap_space, for asm's sake */
};
-struct md_coredump {
- struct reg md_reg;
- struct fpreg md_fpreg;
-};
-
-
#endif /* _MACHINE_PCB_H_ */
-/* $OpenBSD: vm_machdep.c,v 1.62 2015/03/31 04:35:50 guenther Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.63 2015/05/05 02:13:46 guenther Exp $ */
/* $NetBSD: vm_machdep.c,v 1.61 1996/05/03 19:42:35 christos Exp $ */
/*-
#include <sys/vnode.h>
#include <sys/buf.h>
#include <sys/user.h>
-#include <sys/core.h>
#include <sys/exec.h>
#include <sys/ptrace.h>
sched_exit(p);
}
-/*
- * Dump the machine specific segment at the start of a core dump.
- */
-struct md_core {
- struct reg intreg;
- struct fpreg freg;
-};
-
-int
-cpu_coredump(struct proc *p, struct vnode *vp, struct ucred *cred,
- struct core *chdr)
-{
- struct md_core md_core;
- struct coreseg cseg;
- int error;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_I386, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof(md_core);
-
- /* Save integer registers. */
- error = process_read_regs(p, &md_core.intreg);
- if (error)
- return error;
-
- /* Save floating point registers. */
- error = process_read_fpregs(p, &md_core.freg);
- if (error)
- return error;
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_I386, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
- 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_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- chdr->c_nseg++;
- return 0;
-}
-
/*
* Convert kernel VA to physical address
*/
-/* $OpenBSD: pcb.h,v 1.17 2013/05/08 15:36:30 tedu Exp $ */
+/* $OpenBSD: pcb.h,v 1.18 2015/05/05 02:13:46 guenther Exp $ */
/* $NetBSD: pcb.h,v 1.21 1996/01/08 13:51:42 mycroft Exp $ */
/*-
#define TSEG_FS 0
#define TSEG_GS 1
-/*
- * The pcb is augmented with machine-dependent additional data for
- * core dumps. For the i386, there is nothing to add.
- */
-struct md_coredump {
- long md_pad[8];
-};
-
#endif /* _MACHINE_PCB_H_ */
-/* $OpenBSD: hibernate_machdep.c,v 1.7 2014/07/20 19:47:53 deraadt Exp $ */
+/* $OpenBSD: hibernate_machdep.c,v 1.8 2015/05/05 02:13:46 guenther Exp $ */
/*
* Copyright (c) 2013 Paul Irofti.
#include <sys/hibernate.h>
#include <sys/timeout.h>
#include <sys/malloc.h>
-#include <sys/kcore.h>
#include <uvm/uvm_extern.h>
#include <uvm/uvm_pmemrange.h>
-/* $OpenBSD: machdep.c,v 1.61 2014/12/10 15:29:53 mikeb Exp $ */
+/* $OpenBSD: machdep.c,v 1.62 2015/05/05 02:13:46 guenther Exp $ */
/*
* Copyright (c) 2009, 2010, 2014 Miodrag Vallat.
#ifdef SYSVSEM
#include <sys/sem.h>
#endif
-#include <sys/kcore.h>
#include <net/if.h>
-/* $OpenBSD: pcb.h,v 1.6 2013/07/17 19:19:29 miod Exp $ */
+/* $OpenBSD: pcb.h,v 1.7 2015/05/05 02:13:46 guenther Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* Mach Operating System
#define USER_REGS(p) \
(((struct reg *)(&((p)->p_addr->u_pcb.user_state))))
-/*
- * The pcb is augmented with machine-dependent additional data for
- * core dumps. Note that the trapframe here is a copy of the one
- * from the top of the kernel stack (included here so that the kernel
- * stack itself need not be dumped).
- */
-struct md_coredump {
- struct trapframe md_tf;
-};
-
#endif /* _M88K_PCB_H_ */
-/* $OpenBSD: vm_machdep.c,v 1.23 2014/11/16 12:30:58 deraadt Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.24 2015/05/05 02:13:47 guenther Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
#include <sys/buf.h>
#include <sys/user.h>
#include <sys/vnode.h>
-#include <sys/core.h>
#include <sys/exec.h>
#include <sys/ptrace.h>
sched_exit(p);
}
-/*
- * Dump the machine specific header information at the start of a core dump.
- */
-int
-cpu_coredump(p, vp, cred, chdr)
- struct proc *p;
- struct vnode *vp;
- struct ucred *cred;
- struct core *chdr;
-{
- struct reg reg;
- struct coreseg cseg;
- int error;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_MACHINE, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof(reg);
-
- /* Save registers. */
- error = process_read_regs(p, ®);
- if (error)
- return error;
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_MACHINE, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)®, sizeof(reg),
- (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE,
- IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- chdr->c_nseg++;
- return 0;
-}
-
/*
* Map an IO request into kernel virtual address space via phys_map.
*/
-/* $OpenBSD: pcb.h,v 1.6 2014/03/22 00:01:04 miod Exp $ */
+/* $OpenBSD: pcb.h,v 1.7 2015/05/05 02:13:47 guenther Exp $ */
/*
* Copyright (c) 1988 University of Utah.
vaddr_t pcb_wiredpc; /* last tracked pc value within above */
};
-/*
- * The pcb is augmented with machine-dependent additional data for
- * core dumps. For the MIPS, there is nothing to add.
- */
-struct md_coredump {
- long md_pad[8];
-};
-
#endif /* !_MIPS64_PCB_H_ */
-/* $OpenBSD: vm_machdep.c,v 1.31 2014/12/16 18:30:03 tedu Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.32 2015/05/05 02:13:47 guenther Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1992, 1993
#include <sys/buf.h>
#include <sys/vnode.h>
#include <sys/user.h>
-#include <sys/core.h>
#include <sys/exec.h>
#include <sys/signalvar.h>
sched_exit(p);
}
-/*
- * Dump the machine specific header information at the start of a core dump.
- */
-int
-cpu_coredump(p, vp, cred, chdr)
- struct proc *p;
- struct vnode *vp;
- struct ucred *cred;
- struct core *chdr;
-{
- struct cpu_info *ci = curcpu();
- int error;
- /*register struct user *up = p->p_addr;*/
- struct coreseg cseg;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_MIPS, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof (p -> p_addr -> u_pcb.pcb_regs);
-
- /*
- * Copy floating point state from the FP chip if this process
- * has state stored there.
- */
- if (p == ci->ci_fpuproc)
- save_fpu();
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_MIPS, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE,
- IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- error = vn_rdwr(UIO_WRITE, vp,
- (caddr_t)(&(p -> p_addr -> u_pcb.pcb_regs)),
- (off_t)chdr -> c_cpusize,
- (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize),
- UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
-
- if (!error)
- chdr->c_nseg++;
-
- return error;
-}
-
extern vm_map_t phys_map;
/*
-/* $OpenBSD: pcb.h,v 1.13 2011/08/22 18:18:35 deraadt Exp $ */
+/* $OpenBSD: pcb.h,v 1.14 2015/05/05 02:13:47 guenther Exp $ */
/* $NetBSD: pcb.h,v 1.1 1996/09/30 16:34:29 ws Exp $ */
/*-
struct cpu_info *pcb_veccpu;
};
-struct md_coredump {
- struct reg regs;
-};
-
#ifdef _KERNEL
extern struct proc *fpuproc;
int setfault(faultbuf *env) __returns_twice;
-/* $OpenBSD: vm_machdep.c,v 1.47 2014/11/16 12:30:58 deraadt Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.48 2015/05/05 02:13:47 guenther Exp $ */
/* $NetBSD: vm_machdep.c,v 1.1 1996/09/30 16:34:57 ws Exp $ */
/*
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/param.h>
-#include <sys/core.h>
#include <sys/exec.h>
#include <sys/pool.h>
#include <sys/proc.h>
sched_exit(p);
}
-/*
- * Write the machine-dependent part of a core dump.
- */
-int
-cpu_coredump(struct proc *p, struct vnode *vp, struct ucred *cred,
- struct core *chdr)
-{
- struct coreseg cseg;
- struct md_coredump md_core;
- int error;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_POWERPC, 0);
- chdr->c_hdrsize = ALIGN(sizeof *chdr);
- chdr->c_seghdrsize = ALIGN(sizeof cseg);
- chdr->c_cpusize = sizeof md_core;
-
- process_read_regs(p, &(md_core.regs));
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_POWERPC, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
- 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_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- chdr->c_nseg++;
- return 0;
-}
-
/*
* Map an IO request into kernel virtual address space.
*/
-/* $OpenBSD: pcb.h,v 1.3 2008/06/26 05:42:12 ray Exp $ */
+/* $OpenBSD: pcb.h,v 1.4 2015/05/05 02:13:47 guenther Exp $ */
/* $NetBSD: pcb.h,v 1.7 2002/05/09 12:28:08 uch Exp $ */
/*-
struct fpreg pcb_fp; /* fp context for resume */
};
-struct md_coredump {
-};
-
extern struct pcb *curpcb;
#endif /* !_SH_PCB_H_ */
-/* $OpenBSD: sh_machdep.c,v 1.38 2015/01/20 19:43:21 kettenis Exp $ */
+/* $OpenBSD: sh_machdep.c,v 1.39 2015/05/05 02:13:47 guenther Exp $ */
/* $NetBSD: sh3_machdep.c,v 1.59 2006/03/04 01:13:36 uwe Exp $ */
/*
#include <sys/sched.h>
#include <sys/msg.h>
#include <sys/conf.h>
-#include <sys/core.h>
-#include <sys/kcore.h>
#include <sys/reboot.h>
#include <uvm/uvm_extern.h>
-/* $OpenBSD: vm_machdep.c,v 1.12 2014/11/16 12:30:58 deraadt Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.13 2015/05/05 02:13:47 guenther Exp $ */
/* $NetBSD: vm_machdep.c,v 1.53 2006/08/31 16:49:21 matt Exp $ */
/*
#include <sys/vnode.h>
#include <sys/buf.h>
#include <sys/user.h>
-#include <sys/core.h>
#include <sys/exec.h>
#include <sys/ptrace.h>
#include <sys/signalvar.h>
#endif
}
-/*
- * Dump the machine specific segment at the start of a core dump.
- */
-struct md_core {
- struct reg intreg;
- struct fpreg fpreg;
-};
-
-int
-cpu_coredump(struct proc *p, struct vnode *vp, struct ucred *cred,
- struct core *chdr)
-{
- struct md_core md_core;
- struct coreseg cseg;
- int error;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_MACHINE, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof(md_core);
-
- /* Save integer registers. */
- error = process_read_regs(p, &md_core.intreg);
- if (error)
- return error;
-
-#ifdef SH4
- if (CPU_IS_SH4) {
- error = process_read_fpregs(p, &md_core.fpreg);
- if (error)
- return error;
- }
-#endif
-#ifdef SH3
- if (CPU_IS_SH3)
- bzero(&md_core.fpreg, sizeof(md_core.fpreg));
-#endif
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_MACHINE, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
- 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_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- chdr->c_nseg++;
- return 0;
-}
-
/*
* Map an IO request into kernel virtual address space.
* All requests are (re)mapped into kernel VA space via the phys_map
-/* $OpenBSD: pcb.h,v 1.6 2011/03/23 16:54:37 pirofti Exp $ */
+/* $OpenBSD: pcb.h,v 1.7 2015/05/05 02:13:47 guenther Exp $ */
/* $NetBSD: pcb.h,v 1.4 1995/03/28 18:19:56 jtc Exp $ */
/*
struct rwindow pcb_rw[PCB_MAXWIN]; /* saved windows */
};
-/*
- * The pcb is augmented with machine-dependent additional data for
- * core dumps. Note that the trapframe here is a copy of the one
- * from the top of the kernel stack (included here so that the kernel
- * stack itself need not be dumped).
- */
-struct md_coredump {
- struct trapframe md_tf;
- struct fpstate md_fpstate;
- u_int32_t md_wcookie;
-};
-
#ifdef _KERNEL
extern struct pcb *cpcb;
#endif /* _KERNEL */
-/* $OpenBSD: vm_machdep.c,v 1.59 2015/03/30 20:30:22 miod Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.60 2015/05/05 02:13:47 guenther Exp $ */
/* $NetBSD: vm_machdep.c,v 1.30 1997/03/10 23:55:40 pk Exp $ */
/*
#include <sys/proc.h>
#include <sys/signalvar.h>
#include <sys/user.h>
-#include <sys/core.h>
#include <sys/malloc.h>
#include <sys/buf.h>
#include <sys/exec.h>
pmap_deactivate(p);
sched_exit(p);
}
-
-/*
- * cpu_coredump is called to write a core dump header.
- * (should this be defined elsewhere? machdep.c?)
- */
-int
-cpu_coredump(p, vp, cred, chdr)
- struct proc *p;
- struct vnode *vp;
- struct ucred *cred;
- struct core *chdr;
-{
- int error;
- struct md_coredump md_core;
- struct coreseg cseg;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_SPARC, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof(md_core);
-
- md_core.md_tf = *p->p_md.md_tf;
- md_core.md_wcookie = p->p_addr->u_pcb.pcb_wcookie;
- if (p->p_md.md_fpstate) {
- if (p == cpuinfo.fpproc)
- savefpstate(p->p_md.md_fpstate);
- md_core.md_fpstate = *p->p_md.md_fpstate;
- } else
- bzero((caddr_t)&md_core.md_fpstate, sizeof(struct fpstate));
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_SPARC, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
- 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_UNIT, cred, NULL, p);
- if (!error)
- chdr->c_nseg++;
-
- return error;
-}
-/* $OpenBSD: pcb.h,v 1.9 2011/03/23 16:54:37 pirofti Exp $ */
+/* $OpenBSD: pcb.h,v 1.10 2015/05/05 02:13:47 guenther Exp $ */
/* $NetBSD: pcb.h,v 1.7 2000/12/29 17:12:05 eeh Exp $ */
/*
u_int64_t pcb_rwsp[PCB_MAXWIN];
};
-/*
- * The pcb is augmented with machine-dependent additional data for
- * core dumps. Note that the trapframe here is a copy of the one
- * from the top of the kernel stack (included here so that the kernel
- * stack itself need not be dumped).
- */
-struct md_coredump {
- struct trapframe64 md_tf;
- struct fpstate64 md_fpstate;
- u_int64_t md_wcookie;
-};
-
#ifndef _KERNEL
/* Let gdb compile. We need fancier macros to make these make sense. */
#define pcb_psr pcb_pstate
-/* $OpenBSD: vm_machdep.c,v 1.32 2014/11/16 12:30:59 deraadt Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.33 2015/05/05 02:13:47 guenther Exp $ */
/* $NetBSD: vm_machdep.c,v 1.38 2001/06/30 00:02:20 eeh Exp $ */
/*
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/user.h>
-#include <sys/core.h>
#include <sys/malloc.h>
#include <sys/buf.h>
#include <sys/exec.h>
pmap_deactivate(p);
sched_exit(p);
}
-
-/*
- * cpu_coredump is called to write a core dump header.
- * (should this be defined elsewhere? machdep.c?)
- */
-int
-cpu_coredump(p, vp, cred, chdr)
- struct proc *p;
- struct vnode *vp;
- struct ucred *cred;
- struct core *chdr;
-{
- int error;
- struct md_coredump md_core;
- struct coreseg cseg;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_MACHINE, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof(md_core);
-
- md_core.md_tf = *p->p_md.md_tf;
- md_core.md_wcookie = p->p_addr->u_pcb.pcb_wcookie;
- if (p->p_md.md_fpstate) {
- fpusave_proc(p, 1);
- md_core.md_fpstate = *p->p_md.md_fpstate;
- } else
- bzero((caddr_t)&md_core.md_fpstate,
- sizeof(md_core.md_fpstate));
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_MACHINE, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
- 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_UNIT, cred, NULL, p);
- if (!error)
- chdr->c_nseg++;
-
- return error;
-}
-
-/* $OpenBSD: pcb.h,v 1.8 2013/11/24 22:08:23 miod Exp $ */
+/* $OpenBSD: pcb.h,v 1.9 2015/05/05 02:13:47 guenther Exp $ */
/* $NetBSD: pcb.h,v 1.10 1996/02/02 18:08:26 mycroft Exp $ */
/*
#define AST_MASK 0x07000000
#define AST_PCB 0x04000000
-/* machine-specific core dump; save regs */
-struct md_coredump {
- struct reg md_reg;
-};
-
#endif /* _MACHINE_PCB_H_ */
-/* $OpenBSD: vm_machdep.c,v 1.42 2014/11/16 12:30:59 deraadt Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.43 2015/05/05 02:13:47 guenther Exp $ */
/* $NetBSD: vm_machdep.c,v 1.67 2000/06/29 07:14:34 mrg Exp $ */
/*
#include <sys/user.h>
#include <sys/exec.h>
#include <sys/vnode.h>
-#include <sys/core.h>
#include <sys/mount.h>
#include <sys/device.h>
return (ENOSYS);
};
-/*
- * Dump the machine specific header information at the start of a core dump.
- * First put all regs in PCB for debugging purposes. This is not an good
- * way to do this, but good for my purposes so far.
- */
-int
-cpu_coredump(p, vp, cred, chdr)
- struct proc *p;
- struct vnode *vp;
- struct ucred *cred;
- struct core *chdr;
-{
- struct trapframe *tf;
- struct md_coredump state;
- struct reg *regs = &state.md_reg;
- struct coreseg cseg;
- int error;
-
- tf = p->p_addr->u_pcb.framep;
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_MACHINE, 0);
- chdr->c_hdrsize = sizeof(struct core);
- chdr->c_seghdrsize = sizeof(struct coreseg);
- chdr->c_cpusize = sizeof(struct md_coredump);
-
- bcopy(&tf->r0, ®s->r0, 12 * sizeof(int));
- regs->ap = tf->ap;
- regs->fp = tf->fp;
- regs->sp = tf->sp;
- regs->pc = tf->pc;
- regs->psl = tf->psl;
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_MACHINE, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&state, sizeof(state),
- (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE,
- IO_UNIT, cred, NULL, p);
-
- if (!error)
- chdr->c_nseg++;
-
- return error;
-}
-
/*
* Map in a bunch of pages read/writeable for the kernel.
*/
-/* $OpenBSD: zaurus_machdep.c,v 1.56 2015/01/18 10:17:42 jsg Exp $ */
+/* $OpenBSD: zaurus_machdep.c,v 1.57 2015/05/05 02:13:47 guenther Exp $ */
/* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */
/*
#include <sys/msgbuf.h>
#include <sys/reboot.h>
#include <sys/termios.h>
-#include <sys/kcore.h>
#include <uvm/uvm_extern.h>
-/* $OpenBSD: linux_exec.c,v 1.42 2014/07/12 18:50:00 tedu Exp $ */
+/* $OpenBSD: linux_exec.c,v 1.43 2015/05/05 02:13:47 guenther Exp $ */
/* $NetBSD: linux_exec.c,v 1.13 1996/04/05 00:01:10 christos Exp $ */
/*-
#include <sys/namei.h>
#include <sys/vnode.h>
#include <sys/mount.h>
-#include <sys/core.h>
#include <sys/exec.h>
#include <sys/exec_elf.h>
elf32_copyargs,
setregs,
exec_elf32_fixup,
- coredump_trad,
+ NULL, /* coredump */
linux_sigcode,
linux_esigcode,
0,
-/* $OpenBSD: db_structinfo.c,v 1.12 2015/01/27 10:12:45 dlg Exp $ */
+/* $OpenBSD: db_structinfo.c,v 1.13 2015/05/05 02:13:46 guenther Exp $ */
/* public domain */
/*
* This file is intended to be compiled with debug information,
#include <sys/acct.h>
#include <sys/buf.h>
#include <sys/conf.h>
-#include <sys/core.h>
#include <sys/disk.h>
#include <sys/disklabel.h>
#include <sys/dirent.h>
-/* $OpenBSD: init_main.c,v 1.238 2015/05/01 11:18:21 miod Exp $ */
+/* $OpenBSD: init_main.c,v 1.239 2015/05/05 02:13:46 guenther Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
*/
#include <sys/param.h>
-#include <sys/core.h>
#include <sys/filedesc.h>
#include <sys/file.h>
#include <sys/errno.h>
0,
copyargs,
setregs,
- NULL,
- coredump_trad,
+ NULL, /* fixup */
+ NULL, /* coredump */
sigcode,
esigcode,
EMUL_ENABLED | EMUL_NATIVE,
-/* $OpenBSD: kern_sig.c,v 1.179 2015/03/14 03:38:50 jsg Exp $ */
+/* $OpenBSD: kern_sig.c,v 1.180 2015/05/05 02:13:46 guenther Exp $ */
/* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */
/*
char name[MAXPATHLEN];
const char *dir = "/var/crash";
+ if (pr->ps_emul->e_coredump == NULL)
+ return (EINVAL);
+
pr->ps_flags |= PS_COREDUMP;
/*
#endif
}
-int
-coredump_trad(struct proc *p, void *cookie)
-{
-#ifdef SMALL_KERNEL
- return EPERM;
-#else
- struct coredump_iostate *io = cookie;
- struct vmspace *vm = io->io_proc->p_vmspace;
- struct vnode *vp = io->io_vp;
- struct ucred *cred = io->io_cred;
- struct core core;
- int error;
-
- core.c_midmag = 0;
- strlcpy(core.c_name, p->p_comm, sizeof(core.c_name));
- core.c_nseg = 0;
- core.c_signo = p->p_sisig;
- core.c_ucode = p->p_sitrapno;
- core.c_cpusize = 0;
- core.c_tsize = (u_long)ptoa(vm->vm_tsize);
- core.c_dsize = (u_long)ptoa(vm->vm_dsize);
- core.c_ssize = (u_long)round_page(ptoa(vm->vm_ssize));
- error = cpu_coredump(p, vp, cred, &core);
- if (error)
- return (error);
- /*
- * uvm_coredump() spits out all appropriate segments.
- * All that's left to do is to write the core header.
- */
- error = uvm_coredump(p, vp, cred, &core);
- if (error)
- return (error);
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&core,
- (int)core.c_hdrsize, (off_t)0,
- UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
- return (error);
-#endif
-}
-
#ifndef SMALL_KERNEL
int
coredump_write(void *cookie, enum uio_seg segflg, const void *data, size_t len)
-/* $OpenBSD: core.h,v 1.5 2013/01/15 01:34:27 deraadt Exp $ */
+/* $OpenBSD: core.h,v 1.6 2015/05/05 02:13:46 guenther Exp $ */
/* $NetBSD: core.h,v 1.4 1994/10/29 08:20:14 cgd Exp $ */
/*
#define CORE_DATA 2
#define CORE_STACK 4
+#ifndef _KERNEL
/*
+ * XXX OBSOLETE, NO LONGER USED
* A core file consists of a header followed by a number of segments.
* Each segment is preceded by a `coreseg' structure giving the
* segment's type, the virtual address where the bits resided in
u_long c_size; /* Size of this segment */
};
-#ifdef _KERNEL
-int coredump_trad(struct proc *, void *);
-
+#else
int coredump_write(void *, enum uio_seg, const void *, size_t);
void coredump_unmap(void *, vaddr_t, vaddr_t);
#endif
-/* $OpenBSD: signalvar.h,v 1.27 2014/03/22 06:05:45 guenther Exp $ */
+/* $OpenBSD: signalvar.h,v 1.28 2015/05/05 02:13:46 guenther Exp $ */
/* $NetBSD: signalvar.h,v 1.17 1996/04/22 01:23:31 christos Exp $ */
/*
*/
void sendsig(sig_t action, int sig, int returnmask, u_long code,
int type, union sigval val);
-struct core;
-struct vnode;
-struct ucred;
-int cpu_coredump(struct proc *, struct vnode *, struct ucred *,
- struct core *);
#endif /* _KERNEL */
#endif /* !_SYS_SIGNALVAR_H_ */
-/* $OpenBSD: uvm_extern.h,v 1.131 2015/02/07 08:21:24 miod Exp $ */
+/* $OpenBSD: uvm_extern.h,v 1.132 2015/05/05 02:13:46 guenther Exp $ */
/* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */
/*
#ifdef _KERNEL
struct buf;
-struct core;
struct mount;
struct pglist;
struct vmspace;
void uvm_pglistfree(struct pglist *);
void uvm_pmr_use_inc(paddr_t, paddr_t);
void uvm_swap_init(void);
-int uvm_coredump(struct proc *, struct vnode *,
- struct ucred *, struct core *);
int uvm_coredump_walkmap(struct proc *,
void *, int (*)(struct proc *, void *,
struct uvm_coredump_state *), void *);
-/* $OpenBSD: uvm_unix.c,v 1.55 2015/02/09 09:39:09 miod Exp $ */
+/* $OpenBSD: uvm_unix.c,v 1.56 2015/05/05 02:13:46 guenther Exp $ */
/* $NetBSD: uvm_unix.c,v 1.18 2000/09/13 15:00:25 thorpej Exp $ */
/*
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/vnode.h>
-#include <sys/core.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#ifndef SMALL_KERNEL
/*
- * uvm_coredump: dump core!
+ * Walk the VA space for a process, invoking 'func' on each present range
+ * that should be included in a coredump.
*/
-
-int
-uvm_coredump(struct proc *p, struct vnode *vp, struct ucred *cred,
- struct core *chdr)
-{
- struct vmspace *vm = p->p_vmspace;
- vm_map_t map = &vm->vm_map;
- vm_map_entry_t entry, safe;
- vaddr_t start, end, top;
- struct coreseg cseg;
- off_t offset, coffset;
- int csize, chunk, flag, error = 0;
-
- offset = chdr->c_hdrsize + chdr->c_seghdrsize + chdr->c_cpusize;
-
- RB_FOREACH_SAFE(entry, uvm_map_addr, &map->addr, safe) {
- /* should never happen for a user process */
- if (UVM_ET_ISSUBMAP(entry)) {
- panic("uvm_coredump: user process with submap?");
- }
-
- if (!(entry->protection & PROT_WRITE) &&
- entry->start != p->p_p->ps_sigcode)
- continue;
-
- /* Don't dump mmaped devices. */
- if (entry->object.uvm_obj != NULL &&
- UVM_OBJ_IS_DEVICE(entry->object.uvm_obj))
- continue;
-
- start = entry->start;
- end = entry->end;
-
- if (start >= VM_MAXUSER_ADDRESS)
- continue;
-
- if (end > VM_MAXUSER_ADDRESS)
- end = VM_MAXUSER_ADDRESS;
-
-#ifdef MACHINE_STACK_GROWS_UP
- if ((vaddr_t)vm->vm_maxsaddr <= start &&
- start < ((vaddr_t)vm->vm_maxsaddr + MAXSSIZ)) {
- top = round_page((vaddr_t)vm->vm_maxsaddr +
- ptoa(vm->vm_ssize));
- if (end > top)
- end = top;
-
- if (start >= end)
- continue;
-#else
- if (start >= (vaddr_t)vm->vm_maxsaddr) {
- top = trunc_page((vaddr_t)vm->vm_minsaddr -
- ptoa(vm->vm_ssize));
- if (start < top)
- start = top;
-
- if (start >= end)
- continue;
-#endif
- flag = CORE_STACK;
- } else
- flag = CORE_DATA;
-
- /* Set up a new core file segment. */
- CORE_SETMAGIC(cseg, CORESEGMAGIC, CORE_GETMID(*chdr), flag);
- cseg.c_addr = start;
- cseg.c_size = end - start;
-
- error = vn_rdwr(UIO_WRITE, vp,
- (caddr_t)&cseg, chdr->c_seghdrsize,
- offset, UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
- /*
- * We might get an EFAULT on objects mapped beyond
- * EOF. Ignore the error.
- */
- if (error && error != EFAULT)
- break;
-
- offset += chdr->c_seghdrsize;
-
- coffset = 0;
- csize = (int)cseg.c_size;
- do {
- if (p->p_siglist & sigmask(SIGKILL))
- return (EINTR);
-
- /* Rest of the loop sleeps with lock held, so... */
- yield();
-
- chunk = MIN(csize, MAXPHYS);
- error = vn_rdwr(UIO_WRITE, vp,
- (caddr_t)(u_long)cseg.c_addr + coffset,
- chunk, offset + coffset, UIO_USERSPACE,
- IO_UNIT, cred, NULL, p);
- if (error)
- return (error);
-
- coffset += chunk;
- csize -= chunk;
- } while (csize > 0);
- offset += cseg.c_size;
-
- /* Discard the memory */
- uvm_unmap(map, cseg.c_addr, cseg.c_addr + cseg.c_size);
-
- chdr->c_nseg++;
- }
-
- return (error);
-}
-
int
uvm_coredump_walkmap(struct proc *p, void *iocookie,
int (*func)(struct proc *, void *, struct uvm_coredump_state *),
/* should never happen for a user process */
if (UVM_ET_ISSUBMAP(entry)) {
- panic("uvm_coredump: user process with submap?");
+ panic("%s: user process with submap?", __func__);
}
if (!(entry->protection & PROT_WRITE) &&