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