1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* genconst generates datamodel-independent constants. Such constants
* are enum values and constants defined via preprocessor macros.
* Under no circumstances should this program generate structure size
* or structure member offset information, those belong in offsets.in.
*/
#ifndef _GENASSYM
#define _GENASSYM
#endif
/*
* This user program uses the kernel header files and the kernel prototype
* for "exit" isn't appropriate for programs linked against libc so exit
* is mapped to kern_exit by the preprocessor and an appropriate exit
* prototype is provided after the header files are included.
*/
#define exit kern_exit
#include <sys/types.h>
#include <sys/param.h>
#include <sys/elf_notes.h>
#include <sys/systm.h>
#include <sys/stream.h>
#include <sys/strsubr.h>
#include <sys/sunddi.h>
#include <sys/ddi_impldefs.h>
#include <sys/file.h>
#include <sys/msacct.h>
#include <sys/cpu.h>
#include <sys/cpuvar.h>
#include <sys/psr_compat.h>
#include <sys/avintr.h>
#include <sys/dtrace.h>
#include <vm/hat.h>
#include <vm/as.h>
#include <vm/seg.h>
#undef exit /* unhide exit, see comment above */
extern void exit(int);
/*
* Proactively discourage anyone from referring to structures or
* member offsets in this program.
*/
#define struct struct...
#define OFFSET OFFSET...
int
main(int argc, char *argv[])
{
printf("#define\tSSLEEP 0x%x\n", SSLEEP);
printf("#define\tSRUN 0x%x\n", SRUN);
printf("#define\tSONPROC 0x%x\n", SONPROC);
printf("#define\tT_INTR_THREAD %d\n", T_INTR_THREAD);
printf("#define\tTP_MSACCT 0x%x\n", TP_MSACCT);
printf("#define\tTP_WATCHPT 0x%x\n", TP_WATCHPT);
printf("#define\tTS_FREE 0x%x\n", TS_FREE);
printf("#define\tTS_ZOMB 0x%x\n", TS_ZOMB);
printf("#define\tTS_ONPROC 0x%x\n", TS_ONPROC);
printf("#define\tNSYSCALL %d\n", NSYSCALL);
printf("#define\tSE_64RVAL 0x%x\n", SE_64RVAL);
printf("#define\tSE_32RVAL1 0x%x\n", SE_32RVAL1);
printf("#define\tSE_32RVAL2 0x%x\n", SE_32RVAL2);
printf("#define\tCACHE_PAC 0x%x\n", CACHE_PAC);
printf("#define\tCACHE_VAC 0x%x\n", CACHE_VAC);
printf("#define\tCACHE_WRITEBACK 0x%x\n", CACHE_WRITEBACK);
printf("#define\tS_READ 0x%x\n", S_READ);
printf("#define\tS_WRITE 0x%x\n", S_WRITE);
printf("#define\tS_EXEC 0x%x\n", S_EXEC);
printf("#define\tS_OTHER 0x%x\n", S_OTHER);
printf("#define\tLWP_USER 0x%x\n", LWP_USER);
printf("#define\tLWP_SYS 0x%x\n", LWP_SYS);
printf("#define\tLMS_USER 0x%x\n", LMS_USER);
printf("#define\tLMS_SYSTEM 0x%x\n", LMS_SYSTEM);
printf("#define\tPSR_PIL_BIT %d\n", bit(PSR_PIL));
printf("#define\tELF_NOTE_SOLARIS \"%s\"\n", ELF_NOTE_SOLARIS);
printf("#define\tELF_NOTE_PAGESIZE_HINT %d\n", ELF_NOTE_PAGESIZE_HINT);
printf("#define\tAV_INT_SPURIOUS %d\n", AV_INT_SPURIOUS);
printf("#define\tCPU_ENABLE %d\n", CPU_ENABLE);
printf("#define\tCPU_READY %d\n", CPU_READY);
printf("#define\tCPU_QUIESCED %d\n", CPU_QUIESCED);
printf("#define\tCPU_INTRSTAT_LOW_PIL_OFFSET %d\n", (LOCK_LEVEL + 1) *
sizeof (uint64_t) * 2);
printf("#define\tCPU_DTRACE_NOFAULT 0x%x\n", CPU_DTRACE_NOFAULT);
printf("#define\tCPU_DTRACE_BADADDR 0x%x\n", CPU_DTRACE_BADADDR);
printf("#define\tDMP_NOSYNC\t0x%x\n", DMP_NOSYNC);
printf("#define\tRW_WRITER\t0x%x\n", RW_WRITER);
printf("#define\tRW_READER\t0x%x\n", RW_READER);
printf("#define\tSQ_EXCL 0x%x\n", SQ_EXCL);
printf("#define\tSQ_BLOCKED 0x%x\n", SQ_BLOCKED);
printf("#define\tSQ_FROZEN 0x%x\n", SQ_FROZEN);
printf("#define\tSQ_WRITER 0x%x\n", SQ_WRITER);
printf("#define\tSQ_QUEUED 0x%x\n", SQ_QUEUED);
printf("#define\tSQ_WANTWAKEUP 0x%x\n", SQ_WANTWAKEUP);
printf("#define\tSQ_WANTEXWAKEUP 0x%x\n", SQ_WANTEXWAKEUP);
printf("#define\tSQ_CIPUT 0x%x\n", SQ_CIPUT);
printf("#define\tSQ_TYPEMASK 0x%x\n", SQ_TYPEMASK);
printf("#define\tSQ_GOAWAY 0x%x\n", SQ_GOAWAY);
printf("#define\tSQ_STAYAWAY 0x%x\n", SQ_STAYAWAY);
printf("#define\tSQ_PERMOD 0x%x\n", SQ_PERMOD);
printf("#define\tFKIOCTL\t0x%x\n", FKIOCTL);
printf("#define\tLOCK_MASK\t0xff000000\n");
printf("#define\tDDI_DEV_NO_AUTOINCR %d\n", DDI_DEV_NO_AUTOINCR);
printf("#define\tDDI_DEV_AUTOINCR %d\n", DDI_DEV_AUTOINCR);
printf("#define\tDTRACE_IDSIZE %d\n", sizeof (dtrace_id_t));
printf("#define\tMODS_NOUNLOAD 0x%x\n", MODS_NOUNLOAD);
printf("#define\tMODS_WEAK 0x%x\n", MODS_WEAK);
printf("#define\tMODS_INSTALLED 0x%x\n", MODS_INSTALLED);
printf("#define\tKPREEMPT_SYNC %d\n", KPREEMPT_SYNC);
exit(0);
}
int
bit(long mask)
{
int i;
for (i = 0; i < sizeof (mask) * NBBY; i++) {
if (mask & 1)
return (i);
mask >>= 1;
}
exit(1);
}
|