root/sys/core.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


    1 /*      $OpenBSD: core.h,v 1.3 2003/10/30 21:38:09 jmc Exp $    */
    2 /*      $NetBSD: core.h,v 1.4 1994/10/29 08:20:14 cgd Exp $     */
    3 
    4 /*
    5  * Copyright (c) 1994 Paul Kranenburg
    6  * All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. All advertising materials mentioning features or use of this software
   17  *    must display the following acknowledgement:
   18  *      This product includes software developed by Paul Kranenburg.
   19  * 4. The name of the author may not be used to endorse or promote products
   20  *    derived from this software without specific prior written permission
   21  *
   22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   25  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   27  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   32  */
   33 
   34 #define COREMAGIC       0507
   35 #define CORESEGMAGIC    0510
   36 
   37 /*
   38  * The core structure's c_midmag field (like exec's a_midmag) is a
   39  * network-byteorder encoding of this int
   40  *      FFFFFFmmmmmmmmmmMMMMMMMMMMMMMMMM
   41  * Where `F' is 6 bits of flag (currently unused),
   42  *       `m' is 10 bits of machine-id, and
   43  *       `M' is 16 bits worth of magic number, ie. COREMAGIC.
   44  * The macros below will set/get the needed fields.
   45  */
   46 #define CORE_GETMAGIC(c)  (  ntohl(((c).c_midmag))        & 0xffff )
   47 #define CORE_GETMID(c)    ( (ntohl(((c).c_midmag)) >> 16) & 0x03ff )
   48 #define CORE_GETFLAG(c)   ( (ntohl(((c).c_midmag)) >> 26) & 0x03f  )
   49 #define CORE_SETMAGIC(c,mag,mid,flag) ( (c).c_midmag = htonl ( \
   50                         ( ((flag) & 0x3f)   << 26) | \
   51                         ( ((mid)  & 0x03ff) << 16) | \
   52                         ( ((mag)  & 0xffff)      ) ) )
   53 
   54 /* Flag definitions */
   55 #define CORE_CPU        1
   56 #define CORE_DATA       2
   57 #define CORE_STACK      4
   58 
   59 /*
   60  * A core file consists of a header followed by a number of segments.
   61  * Each segment is preceded by a `coreseg' structure giving the
   62  * segment's type, the virtual address where the bits resided in
   63  * process address space and the size of the segment.
   64  *
   65  * The core header specifies the lengths of the core header itself and
   66  * each of the following core segment headers to allow for any machine
   67  * dependent alignment requirements.
   68  */
   69 
   70 struct core {
   71         u_int32_t c_midmag;             /* magic, id, flags */
   72         u_int16_t c_hdrsize;            /* Size of this header (machdep algn) */
   73         u_int16_t c_seghdrsize;         /* Size of a segment header */
   74         u_int32_t c_nseg;               /* # of core segments */
   75         char    c_name[MAXCOMLEN+1];    /* Copy of p->p_comm */
   76         u_int32_t c_signo;              /* Killing signal */
   77         u_long  c_ucode;                /* Hmm ? */
   78         u_long  c_cpusize;              /* Size of machine dependent segment */
   79         u_long  c_tsize;                /* Size of traditional text segment */
   80         u_long  c_dsize;                /* Size of traditional data segment */
   81         u_long  c_ssize;                /* Size of traditional stack segment */
   82 };
   83 
   84 struct coreseg {
   85         u_int32_t c_midmag;             /* magic, id, flags */
   86         u_long  c_addr;                 /* Virtual address of segment */
   87         u_long  c_size;                 /* Size of this segment */
   88 };

/* [<][>][^][v][top][bottom][index][help] */