xref: /titanic_44/usr/src/uts/i86pc/sys/machparam.h (revision 41791439485c85b85be39df263af7b95e79404b7)
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*41791439Sandrei  * Common Development and Distribution License (the "License").
6*41791439Sandrei  * 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*41791439Sandrei  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
277c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef _SYS_MACHPARAM_H
317c478bd9Sstevel@tonic-gate #define	_SYS_MACHPARAM_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
347c478bd9Sstevel@tonic-gate 
35*41791439Sandrei #if !defined(_ASM)
367c478bd9Sstevel@tonic-gate #include <sys/types.h>
37*41791439Sandrei #endif
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
407c478bd9Sstevel@tonic-gate extern "C" {
417c478bd9Sstevel@tonic-gate #endif
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #ifndef _ASM
447c478bd9Sstevel@tonic-gate #define	ADDRESS_C(c)    c ## ul
457c478bd9Sstevel@tonic-gate #else   /* _ASM */
467c478bd9Sstevel@tonic-gate #define	ADDRESS_C(c)    (c)
477c478bd9Sstevel@tonic-gate #endif  /* _ASM */
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate /*
50*41791439Sandrei  * Machine dependent parameters and limits.
517c478bd9Sstevel@tonic-gate  */
52*41791439Sandrei #if defined(__amd64)
53*41791439Sandrei #define	NCPU	64	/* NBBY * sizeof (ulong_t) for simple cpuset_t */
54*41791439Sandrei #elif defined(__i386)
55*41791439Sandrei #define	NCPU	32
56*41791439Sandrei #else
57*41791439Sandrei #error	"port me"
58*41791439Sandrei #endif
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate /*
617c478bd9Sstevel@tonic-gate  * The value defined below could grow to 16. hat structure and
627c478bd9Sstevel@tonic-gate  * page_t have room for 16 nodes.
637c478bd9Sstevel@tonic-gate  */
647c478bd9Sstevel@tonic-gate #define	MAXNODES 	4
657c478bd9Sstevel@tonic-gate #define	NUMA_NODEMASK	0x0f
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate /*
697c478bd9Sstevel@tonic-gate  * Define the FPU symbol if we could run on a machine with an external
707c478bd9Sstevel@tonic-gate  * FPU (i.e. not integrated with the normal machine state like the vax).
717c478bd9Sstevel@tonic-gate  *
727c478bd9Sstevel@tonic-gate  * The fpu is defined in the architecture manual, and the kernel hides
737c478bd9Sstevel@tonic-gate  * its absence if it is not present, that's pretty integrated, no?
747c478bd9Sstevel@tonic-gate  */
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate /* supported page sizes */
777c478bd9Sstevel@tonic-gate #define	MMU_PAGE_SIZES	2
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /*
807c478bd9Sstevel@tonic-gate  * MMU_PAGES* describes the physical page size used by the mapping hardware.
817c478bd9Sstevel@tonic-gate  * PAGES* describes the logical page size used by the system.
827c478bd9Sstevel@tonic-gate  */
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate #define	MMU_PAGESIZE	0x1000		/* 4096 bytes */
857c478bd9Sstevel@tonic-gate #define	MMU_PAGESHIFT	12		/* log2(MMU_PAGESIZE) */
86*41791439Sandrei 
87*41791439Sandrei #if !defined(_ASM)
887c478bd9Sstevel@tonic-gate #define	MMU_PAGEOFFSET	(MMU_PAGESIZE-1) /* Mask of address bits in page */
89*41791439Sandrei #else	/* !_ASM */
90*41791439Sandrei #define	MMU_PAGEOFFSET	_CONST(MMU_PAGESIZE-1)  /* assembler lameness */
91*41791439Sandrei #endif	/* !_ASM */
92*41791439Sandrei 
937c478bd9Sstevel@tonic-gate #define	MMU_PAGEMASK	(~MMU_PAGEOFFSET)
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate #define	PAGESIZE	0x1000		/* All of the above, for logical */
967c478bd9Sstevel@tonic-gate #define	PAGESHIFT	12
977c478bd9Sstevel@tonic-gate #define	PAGEOFFSET	(PAGESIZE - 1)
987c478bd9Sstevel@tonic-gate #define	PAGEMASK	(~PAGEOFFSET)
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  * DATA_ALIGN is used to define the alignment of the Unix data segment.
1027c478bd9Sstevel@tonic-gate  */
1037c478bd9Sstevel@tonic-gate #define	DATA_ALIGN	PAGESIZE
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate /*
106*41791439Sandrei  * DEFAULT KERNEL THREAD stack size (in pages).
1077c478bd9Sstevel@tonic-gate  */
1087c478bd9Sstevel@tonic-gate #if defined(__amd64)
109*41791439Sandrei #define	DEFAULTSTKSZ_NPGS	5
1107c478bd9Sstevel@tonic-gate #elif defined(__i386)
111*41791439Sandrei #define	DEFAULTSTKSZ_NPGS	2
1127c478bd9Sstevel@tonic-gate #endif
1137c478bd9Sstevel@tonic-gate 
114*41791439Sandrei #if !defined(_ASM)
115*41791439Sandrei #define	DEFAULTSTKSZ	(DEFAULTSTKSZ_NPGS * PAGESIZE)
116*41791439Sandrei #else	/* !_ASM */
117*41791439Sandrei #define	DEFAULTSTKSZ	_MUL(DEFAULTSTKSZ_NPGS, PAGESIZE) /* as(1) lameness */
118*41791439Sandrei #endif	/* !_ASM */
119*41791439Sandrei 
1207c478bd9Sstevel@tonic-gate /*
1217c478bd9Sstevel@tonic-gate  * KERNELBASE is the virtual address at which the kernel segments start in
1227c478bd9Sstevel@tonic-gate  * all contexts.
1237c478bd9Sstevel@tonic-gate  *
1247c478bd9Sstevel@tonic-gate  * KERNELBASE is not fixed on 32-bit systems.  The value of KERNELBASE can
1257c478bd9Sstevel@tonic-gate  * change with installed memory and the eprom variable 'eprom_kernelbase'.
1267c478bd9Sstevel@tonic-gate  * This value is fixed on 64-bit systems.
1277c478bd9Sstevel@tonic-gate  *
1287c478bd9Sstevel@tonic-gate  * common/conf/param.c requires a compile time defined value for KERNELBASE
1297c478bd9Sstevel@tonic-gate  * which it saves in the variable _kernelbase.  If kernelbase is modifed on
1307c478bd9Sstevel@tonic-gate  * a 32-bit system, _kernelbase will be updated with the new value in
1317c478bd9Sstevel@tonic-gate  * i86pc/os/startup.c.
1327c478bd9Sstevel@tonic-gate  *
1337c478bd9Sstevel@tonic-gate  * i86 and i86pc files use kernelbase instead of KERNELBASE, which is
1347c478bd9Sstevel@tonic-gate  * initialized in i86pc/os/startup.c.
1357c478bd9Sstevel@tonic-gate  */
1367c478bd9Sstevel@tonic-gate 
1377c478bd9Sstevel@tonic-gate #if defined(__amd64)
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate #define	KERNELBASE	ADDRESS_C(0xfffffd8000000000)
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate /*
1427c478bd9Sstevel@tonic-gate  * Size of the unmapped "red zone" at the very bottom of the kernel's
1437c478bd9Sstevel@tonic-gate  * address space.  Corresponds to 1 slot in the toplevel pagetable.
1447c478bd9Sstevel@tonic-gate  */
1457c478bd9Sstevel@tonic-gate #define	KERNEL_REDZONE_SIZE   ((uintptr_t)1 << 39)
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate /*
1487c478bd9Sstevel@tonic-gate  * Base of 'core' heap area, which is used for kernel and module text/data
1497c478bd9Sstevel@tonic-gate  * that must be within a 2GB range to allow for rip-relative addressing.
1507c478bd9Sstevel@tonic-gate  *
1517c478bd9Sstevel@tonic-gate  * XX64: because vmx and boot cannot be trusted to stay in a 1GB playpen at
1527c478bd9Sstevel@tonic-gate  * the bottom of the upper 4GB range, we need to restrict the core heap to
1537c478bd9Sstevel@tonic-gate  * the top 1GB for now.
1547c478bd9Sstevel@tonic-gate  */
1557c478bd9Sstevel@tonic-gate #define	COREHEAP_BASE	ADDRESS_C(0xffffffffc0000000)
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate /*
1587c478bd9Sstevel@tonic-gate  * Beginning of the segkpm window
1597c478bd9Sstevel@tonic-gate  */
1607c478bd9Sstevel@tonic-gate #define	SEGKPM_BASE	ADDRESS_C(0xfffffe0000000000)
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate /*
1637c478bd9Sstevel@tonic-gate  * default and boundary sizes for segkp
1647c478bd9Sstevel@tonic-gate  */
1657c478bd9Sstevel@tonic-gate #define	SEGKPDEFSIZE	(2L * 1024L * 1024L * 1024L)		/*   2G */
1667c478bd9Sstevel@tonic-gate #define	SEGKPMAXSIZE	(8L * 1024L * 1024L * 1024L)		/*   8G */
1677c478bd9Sstevel@tonic-gate #define	SEGKPMINSIZE	(200L * 1024 * 1024L)			/* 200M */
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate /*
1707c478bd9Sstevel@tonic-gate  * Boot (or, more precisely, vmx) maps most pages twice - once in the
1717c478bd9Sstevel@tonic-gate  * bottom 2GB of memory and once in the bottom 2GB of the topmost 4GB.
1727c478bd9Sstevel@tonic-gate  * When boot is unmapped this range is available to the kernel, but until
1737c478bd9Sstevel@tonic-gate  * then we have to leave it untouched.
1747c478bd9Sstevel@tonic-gate  */
1757c478bd9Sstevel@tonic-gate #define	BOOT_DOUBLEMAP_BASE	ADDRESS_C(0xffffffff00000000)
1767c478bd9Sstevel@tonic-gate #define	BOOT_DOUBLEMAP_SIZE	ADDRESS_C(0x80000000)
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate /*
1797c478bd9Sstevel@tonic-gate  * VMWare works best if we don't use the top 64Meg of memory for amd64.
1807c478bd9Sstevel@tonic-gate  * Set KERNEL_TEXT to top_o_memory - 64Meg - 8 Meg for 8Meg of nucleus pages.
1817c478bd9Sstevel@tonic-gate  */
1827c478bd9Sstevel@tonic-gate #define	PROMSTART	ADDRESS_C(0xffc00000)
1837c478bd9Sstevel@tonic-gate #define	KERNEL_TEXT	ADDRESS_C(0xfffffffffb800000)
1847c478bd9Sstevel@tonic-gate 
1857c478bd9Sstevel@tonic-gate /*
1867c478bd9Sstevel@tonic-gate  * Define upper limit on user address space
1877c478bd9Sstevel@tonic-gate  *
1887c478bd9Sstevel@tonic-gate  * In amd64, the upper limit on a 64-bit user address space is 1 large page
1897c478bd9Sstevel@tonic-gate  * (2MB) below kernelbase.  The upper limit for a 32-bit user address space
1907c478bd9Sstevel@tonic-gate  * is 1 small page (4KB) below the top of the 32-bit range.  The 64-bit
1917c478bd9Sstevel@tonic-gate  * limit give dtrace the red zone it needs below kernelbase.  The 32-bit
1927c478bd9Sstevel@tonic-gate  * limit gives us a small red zone to detect address-space overruns in a
1937c478bd9Sstevel@tonic-gate  * user program.
1947c478bd9Sstevel@tonic-gate  */
1957c478bd9Sstevel@tonic-gate #define	USERLIMIT	ADDRESS_C(0xfffffd7fffe00000)
1967c478bd9Sstevel@tonic-gate #ifdef bug_5074717_is_fixed
1977c478bd9Sstevel@tonic-gate #define	USERLIMIT32	ADDRESS_C(0xfffff000)
1987c478bd9Sstevel@tonic-gate #else
1997c478bd9Sstevel@tonic-gate #define	USERLIMIT32	ADDRESS_C(0xfefff000)
2007c478bd9Sstevel@tonic-gate #endif
2017c478bd9Sstevel@tonic-gate 
2027c478bd9Sstevel@tonic-gate #elif defined(__i386)
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate #ifdef DEBUG
2057c478bd9Sstevel@tonic-gate #define	KERNELBASE	ADDRESS_C(0xc8000000)
2067c478bd9Sstevel@tonic-gate #else
2077c478bd9Sstevel@tonic-gate #define	KERNELBASE	ADDRESS_C(0xd4000000)
2087c478bd9Sstevel@tonic-gate #endif
2097c478bd9Sstevel@tonic-gate 
2107c478bd9Sstevel@tonic-gate #define	KERNELBASE_MAX	ADDRESS_C(0xe0000000)
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate /*
2137c478bd9Sstevel@tonic-gate  * The i386 ABI requires that the user address space be at least 3Gb
2147c478bd9Sstevel@tonic-gate  * in size.  KERNELBASE_ABI_MIN is used as the default KERNELBASE for
2157c478bd9Sstevel@tonic-gate  * physical memory configurations > 4gb.
2167c478bd9Sstevel@tonic-gate  */
2177c478bd9Sstevel@tonic-gate #define	KERNELBASE_ABI_MIN	ADDRESS_C(0xc0000000)
2187c478bd9Sstevel@tonic-gate 
2197c478bd9Sstevel@tonic-gate /*
2207c478bd9Sstevel@tonic-gate  * Size of the unmapped "red zone" at the very bottom of the kernel's
2217c478bd9Sstevel@tonic-gate  * address space.  Since segmap start immediately above the red zone, this
2227c478bd9Sstevel@tonic-gate  * needs to be MAXBSIZE aligned.
2237c478bd9Sstevel@tonic-gate  */
2247c478bd9Sstevel@tonic-gate #define	KERNEL_REDZONE_SIZE   MAXBSIZE
2257c478bd9Sstevel@tonic-gate 
2267c478bd9Sstevel@tonic-gate /*
2277c478bd9Sstevel@tonic-gate  * This is the last 4MB of the 4G address space. Some psm modules
2287c478bd9Sstevel@tonic-gate  * need this region of virtual address space mapped 1-1
2297c478bd9Sstevel@tonic-gate  */
2307c478bd9Sstevel@tonic-gate #define	PROMSTART	ADDRESS_C(0xffc00000)
2317c478bd9Sstevel@tonic-gate #define	KERNEL_TEXT	ADDRESS_C(0xfe800000)
2327c478bd9Sstevel@tonic-gate 
2337c478bd9Sstevel@tonic-gate /*
2347c478bd9Sstevel@tonic-gate  * Define upper limit on user address space
2357c478bd9Sstevel@tonic-gate  */
2367c478bd9Sstevel@tonic-gate #define	USERLIMIT	KERNELBASE
2377c478bd9Sstevel@tonic-gate #define	USERLIMIT32	USERLIMIT
2387c478bd9Sstevel@tonic-gate 
2397c478bd9Sstevel@tonic-gate #endif	/* __i386 */
2407c478bd9Sstevel@tonic-gate 
241*41791439Sandrei #if !defined(_ASM) && !defined(_KADB)
2427c478bd9Sstevel@tonic-gate extern uintptr_t kernelbase, segkmap_start, segmapsize;
2437c478bd9Sstevel@tonic-gate #endif
2447c478bd9Sstevel@tonic-gate 
2457c478bd9Sstevel@tonic-gate /*
2467c478bd9Sstevel@tonic-gate  * ARGSBASE is the base virtual address of the range which
2477c478bd9Sstevel@tonic-gate  * the kernel uses to map the arguments for exec.
2487c478bd9Sstevel@tonic-gate  */
2497c478bd9Sstevel@tonic-gate #define	ARGSBASE	PROMSTART
2507c478bd9Sstevel@tonic-gate 
2517c478bd9Sstevel@tonic-gate /*
2527c478bd9Sstevel@tonic-gate  * reserve space for modules
2537c478bd9Sstevel@tonic-gate  */
2547c478bd9Sstevel@tonic-gate #define	MODTEXT	(1024 * 1024 * 2)
2557c478bd9Sstevel@tonic-gate #define	MODDATA	(1024 * 300)
2567c478bd9Sstevel@tonic-gate 
2577c478bd9Sstevel@tonic-gate /*
2587c478bd9Sstevel@tonic-gate  * The heap has a region allocated from it of HEAPTEXT_SIZE bytes specifically
2597c478bd9Sstevel@tonic-gate  * for module text.
2607c478bd9Sstevel@tonic-gate  */
2617c478bd9Sstevel@tonic-gate #define	HEAPTEXT_SIZE		(64 * 1024 * 1024)	/* bytes */
2627c478bd9Sstevel@tonic-gate 
2637c478bd9Sstevel@tonic-gate /*
2647c478bd9Sstevel@tonic-gate  * Size of a kernel threads stack.  It must be a whole number of pages
2657c478bd9Sstevel@tonic-gate  * since the segment it comes from will only allocate space in pages.
2667c478bd9Sstevel@tonic-gate  */
2677c478bd9Sstevel@tonic-gate #define	T_STACKSZ	2*PAGESIZE
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate /*
2707c478bd9Sstevel@tonic-gate  * Size of a cpu startup thread stack.  (It must be a whole number of pages
2717c478bd9Sstevel@tonic-gate  * since the containing segment only allocates space in pages.)
2727c478bd9Sstevel@tonic-gate  */
2737c478bd9Sstevel@tonic-gate 
2747c478bd9Sstevel@tonic-gate #define	STARTUP_STKSZ	3*PAGESIZE
2757c478bd9Sstevel@tonic-gate 
2767c478bd9Sstevel@tonic-gate /*
2777c478bd9Sstevel@tonic-gate  * Bus types
2787c478bd9Sstevel@tonic-gate  */
2797c478bd9Sstevel@tonic-gate #define	BTISA		1
2807c478bd9Sstevel@tonic-gate #define	BTEISA		2
2817c478bd9Sstevel@tonic-gate #define	BTMCA		3
2827c478bd9Sstevel@tonic-gate 
2837c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2847c478bd9Sstevel@tonic-gate }
2857c478bd9Sstevel@tonic-gate #endif
2867c478bd9Sstevel@tonic-gate 
2877c478bd9Sstevel@tonic-gate #endif	/* _SYS_MACHPARAM_H */
288