1993-06-12 10:58:17 -04:00
|
|
|
/*-
|
|
|
|
|
* Copyright (c) 1990 The Regents of the University of California.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
|
* William Jolitz.
|
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
|
* are met:
|
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
|
* without specific prior written permission.
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
|
*
|
1993-10-08 08:49:55 -04:00
|
|
|
* from: @(#)param.h 5.8 (Berkeley) 6/28/91
|
1999-08-27 21:08:13 -04:00
|
|
|
* $FreeBSD$
|
1993-06-12 10:58:17 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Machine dependent constants for Intel 386.
|
|
|
|
|
*/
|
2000-11-08 11:59:25 -05:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Round p (pointer or byte index) up to a correctly-aligned value
|
|
|
|
|
* for all data types (int, long, ...). The result is unsigned int
|
|
|
|
|
* and must be cast to any desired pointer type.
|
|
|
|
|
*/
|
|
|
|
|
#ifndef _ALIGNBYTES
|
|
|
|
|
#define _ALIGNBYTES (sizeof(int) - 1)
|
|
|
|
|
#endif
|
|
|
|
|
#ifndef _ALIGN
|
|
|
|
|
#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef _NO_NAMESPACE_POLLUTION
|
|
|
|
|
|
2006-01-09 01:05:57 -05:00
|
|
|
#define __HAVE_ACPI
|
|
|
|
|
#define __PCI_REROUTE_INTERRUPT
|
|
|
|
|
|
2000-11-08 11:59:25 -05:00
|
|
|
#ifndef _MACHINE_PARAM_H_
|
|
|
|
|
#define _MACHINE_PARAM_H_
|
|
|
|
|
|
|
|
|
|
#ifndef MACHINE
|
|
|
|
|
#define MACHINE "i386"
|
|
|
|
|
#endif
|
1999-03-01 01:10:16 -05:00
|
|
|
#ifndef MACHINE_ARCH
|
1998-08-31 04:41:58 -04:00
|
|
|
#define MACHINE_ARCH "i386"
|
1999-03-01 01:10:16 -05:00
|
|
|
#endif
|
1998-06-14 11:21:27 -04:00
|
|
|
#define MID_MACHINE MID_I386
|
|
|
|
|
|
2008-03-27 01:03:26 -04:00
|
|
|
#if defined(SMP) || defined(KLD_MODULE)
|
2008-10-01 17:59:04 -04:00
|
|
|
#define MAXCPU 32
|
1997-08-18 01:34:01 -04:00
|
|
|
#else
|
2000-09-23 08:18:06 -04:00
|
|
|
#define MAXCPU 1
|
2008-03-27 01:03:26 -04:00
|
|
|
#endif /* SMP || KLD_MODULE */
|
1997-08-21 01:08:25 -04:00
|
|
|
|
2000-11-08 11:59:25 -05:00
|
|
|
#define ALIGNBYTES _ALIGNBYTES
|
|
|
|
|
#define ALIGN(p) _ALIGN(p)
|
1993-07-27 21:42:17 -04:00
|
|
|
|
2009-04-19 17:26:36 -04:00
|
|
|
/*
|
|
|
|
|
* CACHE_LINE_SIZE is the compile-time maximum cache line size for an
|
|
|
|
|
* architecture. It should be used with appropriate caution.
|
|
|
|
|
*/
|
2009-05-18 15:33:59 -04:00
|
|
|
#define CACHE_LINE_SHIFT 7
|
2009-04-19 16:19:13 -04:00
|
|
|
#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)
|
|
|
|
|
|
1996-05-02 10:21:14 -04:00
|
|
|
#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */
|
1996-05-02 18:25:18 -04:00
|
|
|
#define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */
|
VM system performance improvements from John Dyson and myself. The
following is a summary:
1) increased object cache back up to a more reasonable value.
2) removed old & bogus cruft from machdep.c (clearseg, copyseg,
physcopyseg, etc).
3) inlined many functions in pmap.c
4) changed "load_cr3(rcr3())" into tlbflush() and made tlbflush inline
assembly.
5) changed the way that modified pages are tracked - now vm_page struct
is kept updated directly - no more scanning page tables.
6) removed lots of unnecessary spl's
7) removed old unused functions from pmap.c
8) removed all use of page_size, page_shift, page_mask variables - replaced
with PAGE_ constants.
9) moved trunc/round_page, atop, ptoa, out of vm_param.h and into i386/
include/param.h, and optimized them.
10) numerous changes to sys/vm/ swap_pager, vnode_pager, pageout, fault
code to improve performance. LRU algorithm modified to be more
effective, read ahead/behind values tuned for better performance,
etc, etc...
1994-01-30 23:19:00 -05:00
|
|
|
#define PAGE_MASK (PAGE_SIZE-1)
|
1996-05-02 10:21:14 -04:00
|
|
|
#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))
|
1993-06-12 10:58:17 -04:00
|
|
|
|
2003-03-30 00:24:52 -05:00
|
|
|
#ifdef PAE
|
|
|
|
|
#define NPGPTD 4
|
|
|
|
|
#define PDRSHIFT 21 /* LOG2(NBPDR) */
|
2008-09-25 03:05:17 -04:00
|
|
|
#define NPGPTD_SHIFT 9
|
2003-03-30 00:24:52 -05:00
|
|
|
#else
|
2003-02-23 16:20:00 -05:00
|
|
|
#define NPGPTD 1
|
1993-10-12 03:13:12 -04:00
|
|
|
#define PDRSHIFT 22 /* LOG2(NBPDR) */
|
2008-09-25 03:05:17 -04:00
|
|
|
#define NPGPTD_SHIFT 10
|
2003-03-30 00:24:52 -05:00
|
|
|
#endif
|
2003-02-23 16:20:00 -05:00
|
|
|
|
|
|
|
|
#define NBPTD (NPGPTD<<PAGE_SHIFT)
|
|
|
|
|
#define NPDEPTD (NBPTD/(sizeof (pd_entry_t)))
|
|
|
|
|
#define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t)))
|
1996-05-02 18:25:18 -04:00
|
|
|
#define NBPDR (1<<PDRSHIFT) /* bytes/page dir */
|
1997-08-07 01:15:52 -04:00
|
|
|
#define PDRMASK (NBPDR-1)
|
1993-06-12 10:58:17 -04:00
|
|
|
|
1997-08-08 20:04:06 -04:00
|
|
|
#define IOPAGES 2 /* pages of i/o permission bitmap */
|
2001-08-24 22:20:02 -04:00
|
|
|
|
2001-09-12 04:38:13 -04:00
|
|
|
#ifndef KSTACK_PAGES
|
|
|
|
|
#define KSTACK_PAGES 2 /* Includes pcb! */
|
2001-08-24 22:20:02 -04:00
|
|
|
#endif
|
2003-06-14 19:23:55 -04:00
|
|
|
#define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */
|
2001-09-12 04:38:13 -04:00
|
|
|
|
2001-08-19 20:41:12 -04:00
|
|
|
/*
|
2002-08-31 17:15:29 -04:00
|
|
|
* Ceiling on amount of swblock kva space, can be changed via
|
|
|
|
|
* the kern.maxswzone /boot/loader.conf variable.
|
2001-08-19 20:41:12 -04:00
|
|
|
*/
|
|
|
|
|
#ifndef VM_SWZONE_SIZE_MAX
|
2002-08-31 17:15:29 -04:00
|
|
|
#define VM_SWZONE_SIZE_MAX (32 * 1024 * 1024)
|
2001-08-19 20:41:12 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Ceiling on size of buffer cache (really only effects write queueing,
|
2002-08-31 17:15:29 -04:00
|
|
|
* the VM page cache is not effected), can be changed via
|
|
|
|
|
* the kern.maxbcache /boot/loader.conf variable.
|
2001-08-19 20:41:12 -04:00
|
|
|
*/
|
|
|
|
|
#ifndef VM_BCACHE_SIZE_MAX
|
|
|
|
|
#define VM_BCACHE_SIZE_MAX (200 * 1024 * 1024)
|
|
|
|
|
#endif
|
|
|
|
|
|
1993-06-12 10:58:17 -04:00
|
|
|
/*
|
|
|
|
|
* Mach derived conversion macros
|
|
|
|
|
*/
|
1998-10-13 04:24:45 -04:00
|
|
|
#define trunc_page(x) ((x) & ~PAGE_MASK)
|
|
|
|
|
#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK)
|
2003-03-24 19:07:06 -05:00
|
|
|
#define trunc_4mpage(x) ((x) & ~PDRMASK)
|
|
|
|
|
#define round_4mpage(x) ((((x)) + PDRMASK) & ~PDRMASK)
|
1994-05-25 05:21:21 -04:00
|
|
|
|
2003-03-24 19:07:06 -05:00
|
|
|
#define atop(x) ((x) >> PAGE_SHIFT)
|
|
|
|
|
#define ptoa(x) ((x) << PAGE_SHIFT)
|
VM system performance improvements from John Dyson and myself. The
following is a summary:
1) increased object cache back up to a more reasonable value.
2) removed old & bogus cruft from machdep.c (clearseg, copyseg,
physcopyseg, etc).
3) inlined many functions in pmap.c
4) changed "load_cr3(rcr3())" into tlbflush() and made tlbflush inline
assembly.
5) changed the way that modified pages are tracked - now vm_page struct
is kept updated directly - no more scanning page tables.
6) removed lots of unnecessary spl's
7) removed old unused functions from pmap.c
8) removed all use of page_size, page_shift, page_mask variables - replaced
with PAGE_ constants.
9) moved trunc/round_page, atop, ptoa, out of vm_param.h and into i386/
include/param.h, and optimized them.
10) numerous changes to sys/vm/ swap_pager, vnode_pager, pageout, fault
code to improve performance. LRU algorithm modified to be more
effective, read ahead/behind values tuned for better performance,
etc, etc...
1994-01-30 23:19:00 -05:00
|
|
|
|
2003-03-24 19:07:06 -05:00
|
|
|
#define i386_btop(x) ((x) >> PAGE_SHIFT)
|
|
|
|
|
#define i386_ptob(x) ((x) << PAGE_SHIFT)
|
1993-10-12 03:13:12 -04:00
|
|
|
|
1999-02-19 14:34:49 -05:00
|
|
|
#define pgtok(x) ((x) * (PAGE_SIZE / 1024))
|
|
|
|
|
|
1994-09-18 18:05:22 -04:00
|
|
|
#endif /* !_MACHINE_PARAM_H_ */
|
2000-11-08 11:59:25 -05:00
|
|
|
#endif /* !_NO_NAMESPACE_POLLUTION */
|