17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*42a4b3dcSJonathan Adams * Common Development and Distribution License (the "License"). 6*42a4b3dcSJonathan Adams * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*42a4b3dcSJonathan Adams * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 237c478bd9Sstevel@tonic-gate */ 247c478bd9Sstevel@tonic-gate 257c478bd9Sstevel@tonic-gate #ifndef _MDB_PARAM_H 267c478bd9Sstevel@tonic-gate #define _MDB_PARAM_H 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate #ifdef __cplusplus 297c478bd9Sstevel@tonic-gate extern "C" { 307c478bd9Sstevel@tonic-gate #endif 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate /* 337c478bd9Sstevel@tonic-gate * mdb_param.h 347c478bd9Sstevel@tonic-gate * 357c478bd9Sstevel@tonic-gate * Support header file for mdb_ks module for module developers wishing 367c478bd9Sstevel@tonic-gate * to access macros in <sys/param.h> which expand to the current value 377c478bd9Sstevel@tonic-gate * of kernel global variables. Developers should include <mdb/mdb_param.h> 387c478bd9Sstevel@tonic-gate * rather than <sys/param.h>. This will arrange for the inclusion of 397c478bd9Sstevel@tonic-gate * <sys/param.h>, plus redefinition of all the macros therein to expand 407c478bd9Sstevel@tonic-gate * to the value of globals defined in mdb_ks. The following cpp goop 417c478bd9Sstevel@tonic-gate * is necessary to get <sys/param.h> to *not* define those macros. 427c478bd9Sstevel@tonic-gate */ 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate #ifdef _SYS_PARAM_H 457c478bd9Sstevel@tonic-gate #error "You should not include <sys/param.h> prior to <mdb/mdb_param.h>" 467c478bd9Sstevel@tonic-gate #endif 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate #ifndef _MACHDEP 497c478bd9Sstevel@tonic-gate #define _MACHDEP 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate #ifndef _SYS_MACHPARAM_H 527c478bd9Sstevel@tonic-gate #define _SYS_MACHPARAM_H 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate /* 557c478bd9Sstevel@tonic-gate * Case 1: We defined both _MACHDEP and _SYS_MACHPARAM_H. Undef both 567c478bd9Sstevel@tonic-gate * after we include <sys/param.h>. 577c478bd9Sstevel@tonic-gate */ 587c478bd9Sstevel@tonic-gate #include <sys/param.h> 597c478bd9Sstevel@tonic-gate #undef _SYS_MACHPARAM_H 607c478bd9Sstevel@tonic-gate #undef _MACHDEP 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate #else /* _SYS_MACHPARAM_H */ 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate /* 657c478bd9Sstevel@tonic-gate * Case 2: We defined _MACHDEP only. 667c478bd9Sstevel@tonic-gate */ 677c478bd9Sstevel@tonic-gate #include <sys/param.h> 687c478bd9Sstevel@tonic-gate #undef _MACHDEP 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gate #endif /* _SYS_MACHPARAM_H */ 717c478bd9Sstevel@tonic-gate #else /* _MACHDEP */ 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate #ifndef _SYS_MACHPARAM_H 747c478bd9Sstevel@tonic-gate #define _SYS_MACHPARAM_H 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate /* 777c478bd9Sstevel@tonic-gate * Case 3: We defined _SYS_MACHPARAM_H. 787c478bd9Sstevel@tonic-gate */ 797c478bd9Sstevel@tonic-gate #include <sys/param.h> 807c478bd9Sstevel@tonic-gate #undef _SYS_MACHPARAM_H 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate #else /* _SYS_MACHPARAM_H */ 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate /* 857c478bd9Sstevel@tonic-gate * Case 4: _MACHDEP and _SYS_MACHPARAM_H are both already defined. 867c478bd9Sstevel@tonic-gate */ 877c478bd9Sstevel@tonic-gate #include <sys/param.h> 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate #endif /* _SYS_MACHPARAM_H */ 907c478bd9Sstevel@tonic-gate #endif /* _MACHDEP */ 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate /* 937c478bd9Sstevel@tonic-gate * Extern declarations for global variables defined in the mdb_ks module. 947c478bd9Sstevel@tonic-gate * All of these will be filled in during ks's _mdb_init routine. 957c478bd9Sstevel@tonic-gate */ 967c478bd9Sstevel@tonic-gate extern unsigned long _mdb_ks_pagesize; 977c478bd9Sstevel@tonic-gate extern unsigned int _mdb_ks_pageshift; 987c478bd9Sstevel@tonic-gate extern unsigned long _mdb_ks_pageoffset; 997c478bd9Sstevel@tonic-gate extern unsigned long long _mdb_ks_pagemask; 1007c478bd9Sstevel@tonic-gate extern unsigned long _mdb_ks_mmu_pagesize; 1017c478bd9Sstevel@tonic-gate extern unsigned int _mdb_ks_mmu_pageshift; 1027c478bd9Sstevel@tonic-gate extern unsigned long _mdb_ks_mmu_pageoffset; 1037c478bd9Sstevel@tonic-gate extern unsigned long _mdb_ks_mmu_pagemask; 1047c478bd9Sstevel@tonic-gate extern uintptr_t _mdb_ks_kernelbase; 1057c478bd9Sstevel@tonic-gate extern uintptr_t _mdb_ks_userlimit; 1067c478bd9Sstevel@tonic-gate extern uintptr_t _mdb_ks_userlimit32; 1077c478bd9Sstevel@tonic-gate extern uintptr_t _mdb_ks_argsbase; 1087c478bd9Sstevel@tonic-gate extern unsigned long _mdb_ks_msg_bsize; 1097c478bd9Sstevel@tonic-gate extern unsigned long _mdb_ks_defaultstksz; 1107c478bd9Sstevel@tonic-gate extern int _mdb_ks_ncpu; 111*42a4b3dcSJonathan Adams extern int _mdb_ks_ncpu_log2; 112*42a4b3dcSJonathan Adams extern int _mdb_ks_ncpu_p2; 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate /* 1157c478bd9Sstevel@tonic-gate * Now derive all the macros using the global variables defined in 1167c478bd9Sstevel@tonic-gate * the support library. These macros will in turn be referenced in 1177c478bd9Sstevel@tonic-gate * other kernel macros. 1187c478bd9Sstevel@tonic-gate */ 1197c478bd9Sstevel@tonic-gate #define PAGESIZE _mdb_ks_pagesize 1207c478bd9Sstevel@tonic-gate #define PAGESHIFT _mdb_ks_pageshift 1217c478bd9Sstevel@tonic-gate #define PAGEOFFSET _mdb_ks_pageoffset 1227c478bd9Sstevel@tonic-gate #define PAGEMASK _mdb_ks_pagemask 1237c478bd9Sstevel@tonic-gate #define MMU_PAGESIZE _mdb_ks_mmu_pagesize 1247c478bd9Sstevel@tonic-gate #define MMU_PAGESHIFT _mdb_ks_mmu_pageshift 1257c478bd9Sstevel@tonic-gate #define MMU_PAGEOFFSET _mdb_ks_mmu_pageoffset 1267c478bd9Sstevel@tonic-gate #define MMU_PAGEMASK _mdb_ks_mmu_pagemask 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gate #define KERNELBASE _mdb_ks_kernelbase 1297c478bd9Sstevel@tonic-gate #define USERLIMIT _mdb_ks_userlimit 1307c478bd9Sstevel@tonic-gate #define USERLIMIT32 _mdb_ks_userlimit32 1317c478bd9Sstevel@tonic-gate #define ARGSBASE _mdb_ks_argsbase 1327c478bd9Sstevel@tonic-gate #define MSG_BSIZE _mdb_ks_msg_bsize 1337c478bd9Sstevel@tonic-gate #define DEFAULTSTKSZ _mdb_ks_defaultstksz 1347c478bd9Sstevel@tonic-gate #define NCPU _mdb_ks_ncpu 135*42a4b3dcSJonathan Adams #define NCPU_LOG2 _mdb_ks_ncpu_log2 136*42a4b3dcSJonathan Adams #define NCPU_P2 _mdb_ks_ncpu_p2 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate #define _STRING_H /* Do not re-include <string.h> */ 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1417c478bd9Sstevel@tonic-gate } 1427c478bd9Sstevel@tonic-gate #endif 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gate #endif /* _MDB_PARAM_H */ 145