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
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]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 * genconst generates datamodel-independent constants. Such constants
31 * are enum values and constants defined via preprocessor macros.
32 * Under no circumstances should this program generate structure size
33 * or structure member offset information, those belong in offsets.in.
41 * This user program uses the kernel header files and the kernel prototype
42 * for "exit" isn't appropriate for programs linked against libc so exit
43 * is mapped to kern_exit by the preprocessor and an appropriate exit
44 * prototype is provided after the header files are included.
46 #define exit kern_exit
48 #include <sys/types.h>
49 #include <sys/param.h>
50 #include <sys/elf_notes.h>
51 #include <sys/systm.h>
52 #include <sys/stream.h>
53 #include <sys/strsubr.h>
54 #include <sys/sunddi.h>
55 #include <sys/ddi_impldefs.h>
57 #include <sys/msacct.h>
60 #include <sys/cpuvar.h>
61 #include <sys/psr_compat.h>
62 #include <sys/avintr.h>
63 #include <sys/dtrace.h>
69 #undef exit /* unhide exit, see comment above */
70 extern void exit(int);
73 * Proactively discourage anyone from referring to structures or
74 * member offsets in this program.
76 #define struct struct...
77 #define OFFSET OFFSET...
80 main(int argc
, char *argv
[])
82 printf("#define\tSSLEEP 0x%x\n", SSLEEP
);
83 printf("#define\tSRUN 0x%x\n", SRUN
);
84 printf("#define\tSONPROC 0x%x\n", SONPROC
);
86 printf("#define\tT_INTR_THREAD %d\n", T_INTR_THREAD
);
87 printf("#define\tTP_MSACCT 0x%x\n", TP_MSACCT
);
88 printf("#define\tTP_WATCHPT 0x%x\n", TP_WATCHPT
);
89 printf("#define\tTS_FREE 0x%x\n", TS_FREE
);
90 printf("#define\tTS_ZOMB 0x%x\n", TS_ZOMB
);
91 printf("#define\tTS_ONPROC 0x%x\n", TS_ONPROC
);
92 printf("#define\tNSYSCALL %d\n", NSYSCALL
);
94 printf("#define\tSE_64RVAL 0x%x\n", SE_64RVAL
);
95 printf("#define\tSE_32RVAL1 0x%x\n", SE_32RVAL1
);
96 printf("#define\tSE_32RVAL2 0x%x\n", SE_32RVAL2
);
98 printf("#define\tCACHE_PAC 0x%x\n", CACHE_PAC
);
99 printf("#define\tCACHE_VAC 0x%x\n", CACHE_VAC
);
100 printf("#define\tCACHE_WRITEBACK 0x%x\n", CACHE_WRITEBACK
);
102 printf("#define\tS_READ 0x%x\n", S_READ
);
103 printf("#define\tS_WRITE 0x%x\n", S_WRITE
);
104 printf("#define\tS_EXEC 0x%x\n", S_EXEC
);
105 printf("#define\tS_OTHER 0x%x\n", S_OTHER
);
107 printf("#define\tLWP_USER 0x%x\n", LWP_USER
);
108 printf("#define\tLWP_SYS 0x%x\n", LWP_SYS
);
110 printf("#define\tLMS_USER 0x%x\n", LMS_USER
);
111 printf("#define\tLMS_SYSTEM 0x%x\n", LMS_SYSTEM
);
113 printf("#define\tPSR_PIL_BIT %d\n", bit(PSR_PIL
));
115 printf("#define\tELF_NOTE_SOLARIS \"%s\"\n", ELF_NOTE_SOLARIS
);
116 printf("#define\tELF_NOTE_PAGESIZE_HINT %d\n", ELF_NOTE_PAGESIZE_HINT
);
118 printf("#define\tAV_INT_SPURIOUS %d\n", AV_INT_SPURIOUS
);
120 printf("#define\tCPU_ENABLE %d\n", CPU_ENABLE
);
121 printf("#define\tCPU_READY %d\n", CPU_READY
);
122 printf("#define\tCPU_QUIESCED %d\n", CPU_QUIESCED
);
123 printf("#define\tCPU_INTRSTAT_LOW_PIL_OFFSET %d\n", (LOCK_LEVEL
+ 1) *
124 sizeof (uint64_t) * 2);
126 printf("#define\tCPU_DTRACE_NOFAULT 0x%x\n", CPU_DTRACE_NOFAULT
);
127 printf("#define\tCPU_DTRACE_BADADDR 0x%x\n", CPU_DTRACE_BADADDR
);
129 printf("#define\tDMP_NOSYNC\t0x%x\n", DMP_NOSYNC
);
131 printf("#define\tRW_WRITER\t0x%x\n", RW_WRITER
);
132 printf("#define\tRW_READER\t0x%x\n", RW_READER
);
134 printf("#define\tSQ_EXCL 0x%x\n", SQ_EXCL
);
135 printf("#define\tSQ_BLOCKED 0x%x\n", SQ_BLOCKED
);
136 printf("#define\tSQ_FROZEN 0x%x\n", SQ_FROZEN
);
137 printf("#define\tSQ_WRITER 0x%x\n", SQ_WRITER
);
138 printf("#define\tSQ_QUEUED 0x%x\n", SQ_QUEUED
);
139 printf("#define\tSQ_WANTWAKEUP 0x%x\n", SQ_WANTWAKEUP
);
140 printf("#define\tSQ_WANTEXWAKEUP 0x%x\n", SQ_WANTEXWAKEUP
);
141 printf("#define\tSQ_CIPUT 0x%x\n", SQ_CIPUT
);
142 printf("#define\tSQ_TYPEMASK 0x%x\n", SQ_TYPEMASK
);
143 printf("#define\tSQ_GOAWAY 0x%x\n", SQ_GOAWAY
);
144 printf("#define\tSQ_STAYAWAY 0x%x\n", SQ_STAYAWAY
);
145 printf("#define\tSQ_PERMOD 0x%x\n", SQ_PERMOD
);
147 printf("#define\tFKIOCTL\t0x%x\n", FKIOCTL
);
148 printf("#define\tLOCK_MASK\t0xff000000\n");
150 printf("#define\tDDI_DEV_NO_AUTOINCR %d\n", DDI_DEV_NO_AUTOINCR
);
151 printf("#define\tDDI_DEV_AUTOINCR %d\n", DDI_DEV_AUTOINCR
);
153 printf("#define\tDTRACE_IDSIZE %d\n", sizeof (dtrace_id_t
));
155 printf("#define\tMODS_NOUNLOAD 0x%x\n", MODS_NOUNLOAD
);
156 printf("#define\tMODS_WEAK 0x%x\n", MODS_WEAK
);
157 printf("#define\tMODS_INSTALLED 0x%x\n", MODS_INSTALLED
);
159 printf("#define\tKPREEMPT_SYNC %d\n", KPREEMPT_SYNC
);
168 for (i
= 0; i
< sizeof (mask
) * NBBY
; i
++) {