[BACK]Return to vm_machdep_arm.c CVS log [TXT][DIR] Up to [local] / sys / arch / arm / arm

Annotation of sys/arch/arm/arm/vm_machdep_arm.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: vm_machdep_arm.c,v 1.1 2004/02/01 05:09:48 drahn Exp $ */
                      2: /*     $NetBSD: vm_machdep_arm.c,v 1.7 2003/06/29 22:28:08 fvdl Exp $  */
                      3:
                      4: /*
                      5:  * Copyright (c) 1994-1998 Mark Brinicombe.
                      6:  * Copyright (c) 1994 Brini.
                      7:  * All rights reserved.
                      8:  *
                      9:  * This code is derived from software written for Brini by Mark Brinicombe
                     10:  *
                     11:  * Redistribution and use in source and binary forms, with or without
                     12:  * modification, are permitted provided that the following conditions
                     13:  * are met:
                     14:  * 1. Redistributions of source code must retain the above copyright
                     15:  *    notice, this list of conditions and the following disclaimer.
                     16:  * 2. Redistributions in binary form must reproduce the above copyright
                     17:  *    notice, this list of conditions and the following disclaimer in the
                     18:  *    documentation and/or other materials provided with the distribution.
                     19:  * 3. All advertising materials mentioning features or use of this software
                     20:  *    must display the following acknowledgement:
                     21:  *     This product includes software developed by Brini.
                     22:  * 4. The name of the company nor the name of the author may be used to
                     23:  *    endorse or promote products derived from this software without specific
                     24:  *    prior written permission.
                     25:  *
                     26:  * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
                     27:  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
                     28:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     29:  * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
                     30:  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
                     31:  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
                     32:  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     33:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     34:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     35:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     36:  * SUCH DAMAGE.
                     37:  */
                     38:
                     39: #include <sys/param.h>
                     40:
                     41: #include <sys/core.h>
                     42: #include <sys/exec.h>
                     43: #include <sys/ptrace.h>
                     44: #include <sys/signalvar.h>
                     45: #include <sys/systm.h>
                     46: #include <sys/uio.h>
                     47: #include <sys/vnode.h>
                     48:
                     49: #include <machine/reg.h>
                     50:
                     51:
                     52: /*
                     53:  * Dump the machine specific segment at the start of a core dump.
                     54:  */
                     55:
                     56: int
                     57: cpu_coredump(struct proc *p, struct vnode *vp, struct ucred *cred,
                     58:     struct core *chdr)
                     59: {
                     60:        int error;
                     61:        struct {
                     62:                struct reg regs;
                     63:                struct fpreg fpregs;
                     64:        } cpustate;
                     65:        struct coreseg cseg;
                     66:
                     67:        CORE_SETMAGIC(*chdr, COREMAGIC, MID_MACHINE, 0);
                     68:        chdr->c_hdrsize = ALIGN(sizeof(*chdr));
                     69:        chdr->c_seghdrsize = ALIGN(sizeof(cseg));
                     70:        chdr->c_cpusize = sizeof(cpustate);
                     71:
                     72:        /* Save integer registers. */
                     73:        error = process_read_regs(p, &cpustate.regs);
                     74:        if (error)
                     75:                return error;
                     76:        /* Save floating point registers. */
                     77:        error = process_read_fpregs(p, &cpustate.fpregs);
                     78:        if (error)
                     79:                return error;
                     80:
                     81:        CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_MACHINE, CORE_CPU);
                     82:        cseg.c_addr = 0;
                     83:        cseg.c_size = chdr->c_cpusize;
                     84:
                     85:        error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
                     86:            (off_t)chdr->c_hdrsize, UIO_SYSSPACE,
                     87:            IO_NODELOCKED|IO_UNIT, cred, NULL, p);
                     88:        if (error)
                     89:                return error;
                     90:
                     91:        error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cpustate, sizeof(cpustate),
                     92:            (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE,
                     93:            IO_NODELOCKED|IO_UNIT, cred, NULL, p);
                     94:        if (error)
                     95:                return error;
                     96:
                     97:        chdr->c_nseg++;
                     98:
                     99:        return error;
                    100: }

CVSweb