xref: /illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_param.h (revision 7c478bd9)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_MDB_PARAM_H
28*7c478bd9Sstevel@tonic-gate #define	_MDB_PARAM_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate /*
37*7c478bd9Sstevel@tonic-gate  * mdb_param.h
38*7c478bd9Sstevel@tonic-gate  *
39*7c478bd9Sstevel@tonic-gate  * Support header file for mdb_ks module for module developers wishing
40*7c478bd9Sstevel@tonic-gate  * to access macros in <sys/param.h> which expand to the current value
41*7c478bd9Sstevel@tonic-gate  * of kernel global variables.  Developers should include <mdb/mdb_param.h>
42*7c478bd9Sstevel@tonic-gate  * rather than <sys/param.h>.  This will arrange for the inclusion of
43*7c478bd9Sstevel@tonic-gate  * <sys/param.h>, plus redefinition of all the macros therein to expand
44*7c478bd9Sstevel@tonic-gate  * to the value of globals defined in mdb_ks.  The following cpp goop
45*7c478bd9Sstevel@tonic-gate  * is necessary to get <sys/param.h> to *not* define those macros.
46*7c478bd9Sstevel@tonic-gate  */
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate #ifdef	_SYS_PARAM_H
49*7c478bd9Sstevel@tonic-gate #error "You should not include <sys/param.h> prior to <mdb/mdb_param.h>"
50*7c478bd9Sstevel@tonic-gate #endif
51*7c478bd9Sstevel@tonic-gate 
52*7c478bd9Sstevel@tonic-gate #ifndef _MACHDEP
53*7c478bd9Sstevel@tonic-gate #define	_MACHDEP
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate #ifndef _SYS_MACHPARAM_H
56*7c478bd9Sstevel@tonic-gate #define	_SYS_MACHPARAM_H
57*7c478bd9Sstevel@tonic-gate 
58*7c478bd9Sstevel@tonic-gate /*
59*7c478bd9Sstevel@tonic-gate  * Case 1: We defined both _MACHDEP and _SYS_MACHPARAM_H.  Undef both
60*7c478bd9Sstevel@tonic-gate  * after we include <sys/param.h>.
61*7c478bd9Sstevel@tonic-gate  */
62*7c478bd9Sstevel@tonic-gate #include <sys/param.h>
63*7c478bd9Sstevel@tonic-gate #undef _SYS_MACHPARAM_H
64*7c478bd9Sstevel@tonic-gate #undef _MACHDEP
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate #else	/* _SYS_MACHPARAM_H */
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate /*
69*7c478bd9Sstevel@tonic-gate  * Case 2: We defined _MACHDEP only.
70*7c478bd9Sstevel@tonic-gate  */
71*7c478bd9Sstevel@tonic-gate #include <sys/param.h>
72*7c478bd9Sstevel@tonic-gate #undef _MACHDEP
73*7c478bd9Sstevel@tonic-gate 
74*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_MACHPARAM_H */
75*7c478bd9Sstevel@tonic-gate #else	/* _MACHDEP */
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate #ifndef _SYS_MACHPARAM_H
78*7c478bd9Sstevel@tonic-gate #define	_SYS_MACHPARAM_H
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate /*
81*7c478bd9Sstevel@tonic-gate  * Case 3: We defined _SYS_MACHPARAM_H.
82*7c478bd9Sstevel@tonic-gate  */
83*7c478bd9Sstevel@tonic-gate #include <sys/param.h>
84*7c478bd9Sstevel@tonic-gate #undef _SYS_MACHPARAM_H
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate #else	/* _SYS_MACHPARAM_H */
87*7c478bd9Sstevel@tonic-gate 
88*7c478bd9Sstevel@tonic-gate /*
89*7c478bd9Sstevel@tonic-gate  * Case 4: _MACHDEP and _SYS_MACHPARAM_H are both already defined.
90*7c478bd9Sstevel@tonic-gate  */
91*7c478bd9Sstevel@tonic-gate #include <sys/param.h>
92*7c478bd9Sstevel@tonic-gate 
93*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_MACHPARAM_H */
94*7c478bd9Sstevel@tonic-gate #endif	/* _MACHDEP */
95*7c478bd9Sstevel@tonic-gate 
96*7c478bd9Sstevel@tonic-gate /*
97*7c478bd9Sstevel@tonic-gate  * Extern declarations for global variables defined in the mdb_ks module.
98*7c478bd9Sstevel@tonic-gate  * All of these will be filled in during ks's _mdb_init routine.
99*7c478bd9Sstevel@tonic-gate  */
100*7c478bd9Sstevel@tonic-gate extern unsigned long _mdb_ks_pagesize;
101*7c478bd9Sstevel@tonic-gate extern unsigned int _mdb_ks_pageshift;
102*7c478bd9Sstevel@tonic-gate extern unsigned long _mdb_ks_pageoffset;
103*7c478bd9Sstevel@tonic-gate extern unsigned long long _mdb_ks_pagemask;
104*7c478bd9Sstevel@tonic-gate extern unsigned long _mdb_ks_mmu_pagesize;
105*7c478bd9Sstevel@tonic-gate extern unsigned int _mdb_ks_mmu_pageshift;
106*7c478bd9Sstevel@tonic-gate extern unsigned long _mdb_ks_mmu_pageoffset;
107*7c478bd9Sstevel@tonic-gate extern unsigned long _mdb_ks_mmu_pagemask;
108*7c478bd9Sstevel@tonic-gate extern uintptr_t _mdb_ks_kernelbase;
109*7c478bd9Sstevel@tonic-gate extern uintptr_t _mdb_ks_userlimit;
110*7c478bd9Sstevel@tonic-gate extern uintptr_t _mdb_ks_userlimit32;
111*7c478bd9Sstevel@tonic-gate extern uintptr_t _mdb_ks_argsbase;
112*7c478bd9Sstevel@tonic-gate extern unsigned long _mdb_ks_msg_bsize;
113*7c478bd9Sstevel@tonic-gate extern unsigned long _mdb_ks_defaultstksz;
114*7c478bd9Sstevel@tonic-gate extern int _mdb_ks_ncpu;
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate /*
117*7c478bd9Sstevel@tonic-gate  * Now derive all the macros using the global variables defined in
118*7c478bd9Sstevel@tonic-gate  * the support library.  These macros will in turn be referenced in
119*7c478bd9Sstevel@tonic-gate  * other kernel macros.
120*7c478bd9Sstevel@tonic-gate  */
121*7c478bd9Sstevel@tonic-gate #define	PAGESIZE	_mdb_ks_pagesize
122*7c478bd9Sstevel@tonic-gate #define	PAGESHIFT	_mdb_ks_pageshift
123*7c478bd9Sstevel@tonic-gate #define	PAGEOFFSET	_mdb_ks_pageoffset
124*7c478bd9Sstevel@tonic-gate #define	PAGEMASK	_mdb_ks_pagemask
125*7c478bd9Sstevel@tonic-gate #define	MMU_PAGESIZE	_mdb_ks_mmu_pagesize
126*7c478bd9Sstevel@tonic-gate #define	MMU_PAGESHIFT	_mdb_ks_mmu_pageshift
127*7c478bd9Sstevel@tonic-gate #define	MMU_PAGEOFFSET	_mdb_ks_mmu_pageoffset
128*7c478bd9Sstevel@tonic-gate #define	MMU_PAGEMASK	_mdb_ks_mmu_pagemask
129*7c478bd9Sstevel@tonic-gate 
130*7c478bd9Sstevel@tonic-gate #define	KERNELBASE	_mdb_ks_kernelbase
131*7c478bd9Sstevel@tonic-gate #define	USERLIMIT	_mdb_ks_userlimit
132*7c478bd9Sstevel@tonic-gate #define	USERLIMIT32	_mdb_ks_userlimit32
133*7c478bd9Sstevel@tonic-gate #define	ARGSBASE	_mdb_ks_argsbase
134*7c478bd9Sstevel@tonic-gate #define	MSG_BSIZE	_mdb_ks_msg_bsize
135*7c478bd9Sstevel@tonic-gate #define	DEFAULTSTKSZ	_mdb_ks_defaultstksz
136*7c478bd9Sstevel@tonic-gate #define	NCPU		_mdb_ks_ncpu
137*7c478bd9Sstevel@tonic-gate 
138*7c478bd9Sstevel@tonic-gate #define	_STRING_H	/* Do not re-include <string.h> */
139*7c478bd9Sstevel@tonic-gate 
140*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
141*7c478bd9Sstevel@tonic-gate }
142*7c478bd9Sstevel@tonic-gate #endif
143*7c478bd9Sstevel@tonic-gate 
144*7c478bd9Sstevel@tonic-gate #endif	/* _MDB_PARAM_H */
145