From bce23feba8bc566f1ad6c972bc4f629071e4405e Mon Sep 17 00:00:00 2001 From: imp Date: Mon, 9 Dec 1996 00:13:49 +0000 Subject: [PATCH] For the moment, use the same code that we use in the pmax port to generate core files. This may change again as the gdb port progresses, but is my best current guess. Core files generated by OpenBSD/arc with this change are now known by the file command as being core files. --- sys/arch/arc/arc/vm_machdep.c | 44 ++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/sys/arch/arc/arc/vm_machdep.c b/sys/arch/arc/arc/vm_machdep.c index d27e6b7df69..4fc85e4e914 100644 --- a/sys/arch/arc/arc/vm_machdep.c +++ b/sys/arch/arc/arc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.2 1996/08/26 11:11:57 pefo Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.3 1996/12/09 00:13:49 imp Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -39,11 +39,9 @@ * from: Utah Hdr: vm_machdep.c 1.21 91/04/06 * * from: @(#)vm_machdep.c 8.3 (Berkeley) 1/4/94 - * $Id: vm_machdep.c,v 1.2 1996/08/26 11:11:57 pefo Exp $ + * $Id: vm_machdep.c,v 1.3 1996/12/09 00:13:49 imp Exp $ */ - - #include #include #include @@ -51,6 +49,8 @@ #include #include #include +#include +#include #include #include @@ -181,14 +181,22 @@ void cpu_exit(p) /* * Dump the machine specific header information at the start of a core dump. */ -cpu_coredump(p, vp, cred, core) +cpu_coredump(p, vp, cred, chdr) struct proc *p; struct vnode *vp; struct ucred *cred; - struct core *core; + struct core *chdr; { + int error; + /*register struct user *up = p->p_addr;*/ + struct coreseg cseg; extern struct proc *machFPCurProcPtr; + 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. @@ -196,9 +204,27 @@ cpu_coredump(p, vp, cred, core) if (p == machFPCurProcPtr) MachSaveCurFPState(p); - return (vn_rdwr(UIO_WRITE, vp, (caddr_t)p->p_addr, ctob(UPAGES), - (off_t)0, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, (int *)NULL, - p)); + 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_NODELOCKED|IO_UNIT, cred, (int *)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_NODELOCKED|IO_UNIT, + cred, (int *)NULL, p); + + if (!error) + chdr->c_nseg++; + + return error; } /* -- 2.20.1