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