loader: zfs_bootfs() needs to use config pool txg for boot device
[unleashed.git] / include / syms.h
blobae1336ad5ac4acb421b11eb364ae7613cc17aa6f
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
22 /* Copyright (c) 1988 AT&T */
23 /* All Rights Reserved */
26 #ifndef _SYMS_H
27 #define _SYMS_H
29 /* Storage Classes are defined in storclass.h */
30 #include <storclass.h>
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 /* Number of characters in a symbol name */
37 #define SYMNMLEN 8
38 /* Number of characters in a file name */
39 #define FILNMLEN 14
40 /* Number of array dimensions in auxiliary entry */
41 #define DIMNUM 4
43 struct syment
45 union
47 char _n_name[SYMNMLEN]; /* old COFF version */
48 struct
50 long _n_zeroes; /* new == 0 */
51 long _n_offset; /* offset into string table */
52 } _n_n;
53 char *_n_nptr[2]; /* allows for overlaying */
54 } _n;
55 unsigned long n_value; /* value of symbol */
56 short n_scnum; /* section number */
57 unsigned short n_type; /* type and derived type */
58 char n_sclass; /* storage class */
59 char n_numaux; /* number of aux. entries */
62 #define n_name _n._n_name
63 #define n_nptr _n._n_nptr[1]
64 #define n_zeroes _n._n_n._n_zeroes
65 #define n_offset _n._n_n._n_offset
68 * Relocatable symbols have a section number of the
69 * section in which they are defined. Otherwise, section
70 * numbers have the following meanings:
72 /* undefined symbol */
73 #define N_UNDEF 0
74 /* value of symbol is absolute */
75 #define N_ABS -1
76 /* special debugging symbol -- value of symbol is meaningless */
77 #define N_DEBUG -2
78 /* indicates symbol needs transfer vector (preload) */
79 #define N_TV (unsigned short)-3
81 /* indicates symbol needs transfer vector (postload) */
83 #define P_TV (unsigned short)-4
86 * The fundamental type of a symbol packed into the low
87 * 4 bits of the word.
90 #define _EF ".ef"
92 #define T_NULL 0
93 #define T_ARG 1 /* function argument (only used by compiler) */
94 #define T_CHAR 2 /* character */
95 #define T_SHORT 3 /* short integer */
96 #define T_INT 4 /* integer */
97 #define T_LONG 5 /* long integer */
98 #define T_FLOAT 6 /* floating point */
99 #define T_DOUBLE 7 /* double word */
100 #define T_STRUCT 8 /* structure */
101 #define T_UNION 9 /* union */
102 #define T_ENUM 10 /* enumeration */
103 #define T_MOE 11 /* member of enumeration */
104 #define T_UCHAR 12 /* unsigned character */
105 #define T_USHORT 13 /* unsigned short */
106 #define T_UINT 14 /* unsigned integer */
107 #define T_ULONG 15 /* unsigned long */
110 * derived types are:
113 #define DT_NON 0 /* no derived type */
114 #define DT_PTR 1 /* pointer */
115 #define DT_FCN 2 /* function */
116 #define DT_ARY 3 /* array */
119 * type packing constants
122 #define N_BTMASK 017
123 #define N_TMASK 060
124 #define N_TMASK1 0300
125 #define N_TMASK2 0360
126 #define N_BTSHFT 4
127 #define N_TSHIFT 2
130 * MACROS
133 /* Basic Type of x */
135 #define BTYPE(x) ((x) & N_BTMASK)
137 /* Is x a pointer ? */
139 #define ISPTR(x) (((x) & N_TMASK) == (DT_PTR << N_BTSHFT))
141 /* Is x a function ? */
143 #define ISFCN(x) (((x) & N_TMASK) == (DT_FCN << N_BTSHFT))
145 /* Is x an array ? */
147 #define ISARY(x) (((x) & N_TMASK) == (DT_ARY << N_BTSHFT))
149 /* Is x a structure, union, or enumeration TAG? */
151 #define ISTAG(x) ((x) == C_STRTAG || (x) == C_UNTAG || (x) == C_ENTAG)
153 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(DT_PTR<<N_BTSHFT)|(x&N_BTMASK))
155 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
158 * AUXILIARY ENTRY FORMAT
161 union auxent
163 struct
165 long x_tagndx; /* str, un, or enum tag indx */
166 union
168 struct
170 unsigned short x_lnno; /* declaration line */
171 /* number */
172 unsigned short x_size; /* str, union, array */
173 /* size */
174 } x_lnsz;
175 long x_fsize; /* size of function */
176 } x_misc;
177 union
179 struct /* if ISFCN, tag, or .bb */
181 long x_lnnoptr; /* ptr to fcn line # */
182 long x_endndx; /* entry ndx past */
183 /* block end */
184 } x_fcn;
185 struct /* if ISARY, up to 4 dimen. */
187 unsigned short x_dimen[DIMNUM];
188 } x_ary;
189 } x_fcnary;
190 unsigned short x_tvndx; /* tv index */
191 } x_sym;
192 struct
194 char x_fname[FILNMLEN];
195 } x_file;
196 struct
198 long x_scnlen; /* section length */
199 unsigned short x_nreloc; /* number of reloc entries */
200 unsigned short x_nlinno; /* number of line numbers */
201 } x_scn;
203 struct
205 long x_tvfill; /* tv fill value */
206 unsigned short x_tvlen; /* length of .tv */
207 unsigned short x_tvran[2]; /* tv range */
208 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
211 #define SYMENT struct syment
212 #define SYMESZ 18 /* sizeof(SYMENT) */
214 #define AUXENT union auxent
215 #define AUXESZ 18 /* sizeof(AUXENT) */
217 /* Defines for "special" symbols */
219 #define _ETEXT "etext"
220 #define _EDATA "edata"
221 #define _END "end"
222 #define _START "_start"
224 #ifdef __cplusplus
226 #endif
228 #endif /* _SYMS_H */