4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
35 * Support header file for mdb_ks module for module developers wishing
36 * to access macros in <sys/param.h> which expand to the current value
37 * of kernel global variables. Developers should include <mdb/mdb_param.h>
38 * rather than <sys/param.h>. This will arrange for the inclusion of
39 * <sys/param.h>, plus redefinition of all the macros therein to expand
40 * to the value of globals defined in mdb_ks. The following cpp goop
41 * is necessary to get <sys/param.h> to *not* define those macros.
45 #error "You should not include <sys/param.h> prior to <mdb/mdb_param.h>"
51 #ifndef _SYS_MACHPARAM_H
52 #define _SYS_MACHPARAM_H
55 * Case 1: We defined both _MACHDEP and _SYS_MACHPARAM_H. Undef both
56 * after we include <sys/param.h>.
58 #include <sys/param.h>
59 #undef _SYS_MACHPARAM_H
62 #else /* _SYS_MACHPARAM_H */
65 * Case 2: We defined _MACHDEP only.
67 #include <sys/param.h>
70 #endif /* _SYS_MACHPARAM_H */
73 #ifndef _SYS_MACHPARAM_H
74 #define _SYS_MACHPARAM_H
77 * Case 3: We defined _SYS_MACHPARAM_H.
79 #include <sys/param.h>
80 #undef _SYS_MACHPARAM_H
82 #else /* _SYS_MACHPARAM_H */
85 * Case 4: _MACHDEP and _SYS_MACHPARAM_H are both already defined.
87 #include <sys/param.h>
89 #endif /* _SYS_MACHPARAM_H */
93 * Extern declarations for global variables defined in the mdb_ks module.
94 * All of these will be filled in during ks's _mdb_init routine.
96 extern unsigned long _mdb_ks_pagesize
;
97 extern unsigned int _mdb_ks_pageshift
;
98 extern unsigned long _mdb_ks_pageoffset
;
99 extern unsigned long long _mdb_ks_pagemask
;
100 extern unsigned long _mdb_ks_mmu_pagesize
;
101 extern unsigned int _mdb_ks_mmu_pageshift
;
102 extern unsigned long _mdb_ks_mmu_pageoffset
;
103 extern unsigned long _mdb_ks_mmu_pagemask
;
104 extern uintptr_t _mdb_ks_kernelbase
;
105 extern uintptr_t _mdb_ks_userlimit
;
106 extern uintptr_t _mdb_ks_userlimit32
;
107 extern uintptr_t _mdb_ks_argsbase
;
108 extern unsigned long _mdb_ks_msg_bsize
;
109 extern unsigned long _mdb_ks_defaultstksz
;
110 extern int _mdb_ks_ncpu
;
111 extern int _mdb_ks_ncpu_log2
;
112 extern int _mdb_ks_ncpu_p2
;
115 * Now derive all the macros using the global variables defined in
116 * the support library. These macros will in turn be referenced in
117 * other kernel macros.
119 #define PAGESIZE _mdb_ks_pagesize
120 #define PAGESHIFT _mdb_ks_pageshift
121 #define PAGEOFFSET _mdb_ks_pageoffset
122 #define PAGEMASK _mdb_ks_pagemask
123 #define MMU_PAGESIZE _mdb_ks_mmu_pagesize
124 #define MMU_PAGESHIFT _mdb_ks_mmu_pageshift
125 #define MMU_PAGEOFFSET _mdb_ks_mmu_pageoffset
126 #define MMU_PAGEMASK _mdb_ks_mmu_pagemask
128 #define KERNELBASE _mdb_ks_kernelbase
129 #define USERLIMIT _mdb_ks_userlimit
130 #define USERLIMIT32 _mdb_ks_userlimit32
131 #define ARGSBASE _mdb_ks_argsbase
132 #define MSG_BSIZE _mdb_ks_msg_bsize
133 #define DEFAULTSTKSZ _mdb_ks_defaultstksz
134 #define NCPU _mdb_ks_ncpu
135 #define NCPU_LOG2 _mdb_ks_ncpu_log2
136 #define NCPU_P2 _mdb_ks_ncpu_p2
138 #define _STRING_H /* Do not re-include <string.h> */
144 #endif /* _MDB_PARAM_H */