1993-06-12 14:58:17 +00: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 12:49:55 +00:00
|
|
|
* from: @(#)param.h 5.8 (Berkeley) 6/28/91
|
1999-08-28 01:08:13 +00:00
|
|
|
* $FreeBSD$
|
1993-06-12 14:58:17 +00:00
|
|
|
*/
|
|
|
|
|
2009-09-08 20:45:40 +00:00
|
|
|
#include <machine/_align.h>
|
|
|
|
|
|
|
|
#ifndef _I386_INCLUDE_PARAM_H_
|
|
|
|
#define _I386_INCLUDE_PARAM_H_
|
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
/*
|
|
|
|
* Machine dependent constants for Intel 386.
|
|
|
|
*/
|
2000-11-08 16:59:25 +00: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
|
|
|
|
|
|
|
|
|
2006-01-09 06:05:57 +00:00
|
|
|
#define __HAVE_ACPI
|
|
|
|
#define __PCI_REROUTE_INTERRUPT
|
|
|
|
|
2000-11-08 16:59:25 +00:00
|
|
|
#ifndef MACHINE
|
|
|
|
#define MACHINE "i386"
|
|
|
|
#endif
|
1999-03-01 06:10:16 +00:00
|
|
|
#ifndef MACHINE_ARCH
|
1998-08-31 08:41:58 +00:00
|
|
|
#define MACHINE_ARCH "i386"
|
1999-03-01 06:10:16 +00:00
|
|
|
#endif
|
1998-06-14 15:21:27 +00:00
|
|
|
#define MID_MACHINE MID_I386
|
|
|
|
|
2008-03-27 05:03:26 +00:00
|
|
|
#if defined(SMP) || defined(KLD_MODULE)
|
2008-10-01 21:59:04 +00:00
|
|
|
#define MAXCPU 32
|
1997-08-18 05:34:01 +00:00
|
|
|
#else
|
2000-09-23 12:18:06 +00:00
|
|
|
#define MAXCPU 1
|
2008-03-27 05:03:26 +00:00
|
|
|
#endif /* SMP || KLD_MODULE */
|
1997-08-21 05:08:25 +00:00
|
|
|
|
2000-11-08 16:59:25 +00:00
|
|
|
#define ALIGNBYTES _ALIGNBYTES
|
|
|
|
#define ALIGN(p) _ALIGN(p)
|
2009-07-05 17:45:48 +00:00
|
|
|
/*
|
|
|
|
* ALIGNED_POINTER is a boolean macro that checks whether an address
|
|
|
|
* is valid to fetch data elements of type t from on this architecture.
|
|
|
|
* This does not reflect the optimal alignment, just the possibility
|
|
|
|
* (within reasonable limits).
|
|
|
|
*/
|
|
|
|
#define ALIGNED_POINTER(p, t) 1
|
1993-07-28 01:42:17 +00:00
|
|
|
|
2009-04-19 21:26:36 +00: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 19:33:59 +00:00
|
|
|
#define CACHE_LINE_SHIFT 7
|
2009-04-19 20:19:13 +00:00
|
|
|
#define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT)
|
|
|
|
|
1996-05-02 14:21:14 +00:00
|
|
|
#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */
|
1996-05-02 22:25:18 +00: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-31 04:19:00 +00:00
|
|
|
#define PAGE_MASK (PAGE_SIZE-1)
|
1996-05-02 14:21:14 +00:00
|
|
|
#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))
|
1993-06-12 14:58:17 +00:00
|
|
|
|
2003-03-30 05:24:52 +00:00
|
|
|
#ifdef PAE
|
|
|
|
#define NPGPTD 4
|
|
|
|
#define PDRSHIFT 21 /* LOG2(NBPDR) */
|
2008-09-25 07:05:17 +00:00
|
|
|
#define NPGPTD_SHIFT 9
|
2003-03-30 05:24:52 +00:00
|
|
|
#else
|
2003-02-23 21:20:00 +00:00
|
|
|
#define NPGPTD 1
|
1993-10-12 07:13:12 +00:00
|
|
|
#define PDRSHIFT 22 /* LOG2(NBPDR) */
|
2008-09-25 07:05:17 +00:00
|
|
|
#define NPGPTD_SHIFT 10
|
2003-03-30 05:24:52 +00:00
|
|
|
#endif
|
2003-02-23 21:20:00 +00:00
|
|
|
|
|
|
|
#define NBPTD (NPGPTD<<PAGE_SHIFT)
|
|
|
|
#define NPDEPTD (NBPTD/(sizeof (pd_entry_t)))
|
|
|
|
#define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t)))
|
1996-05-02 22:25:18 +00:00
|
|
|
#define NBPDR (1<<PDRSHIFT) /* bytes/page dir */
|
1997-08-07 05:15:52 +00:00
|
|
|
#define PDRMASK (NBPDR-1)
|
1993-06-12 14:58:17 +00:00
|
|
|
|
2009-09-18 17:04:57 +00:00
|
|
|
#define MAXPAGESIZES 2 /* maximum number of supported page sizes */
|
|
|
|
|
1997-08-09 00:04:06 +00:00
|
|
|
#define IOPAGES 2 /* pages of i/o permission bitmap */
|
2001-08-25 02:20:02 +00:00
|
|
|
|
2001-09-12 08:38:13 +00:00
|
|
|
#ifndef KSTACK_PAGES
|
|
|
|
#define KSTACK_PAGES 2 /* Includes pcb! */
|
2001-08-25 02:20:02 +00:00
|
|
|
#endif
|
2003-06-14 23:23:55 +00:00
|
|
|
#define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */
|
2001-09-12 08:38:13 +00:00
|
|
|
|
2001-08-20 00:41:12 +00:00
|
|
|
/*
|
2002-08-31 21:15:29 +00:00
|
|
|
* Ceiling on amount of swblock kva space, can be changed via
|
|
|
|
* the kern.maxswzone /boot/loader.conf variable.
|
2001-08-20 00:41:12 +00:00
|
|
|
*/
|
|
|
|
#ifndef VM_SWZONE_SIZE_MAX
|
2002-08-31 21:15:29 +00:00
|
|
|
#define VM_SWZONE_SIZE_MAX (32 * 1024 * 1024)
|
2001-08-20 00:41:12 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Ceiling on size of buffer cache (really only effects write queueing,
|
2002-08-31 21:15:29 +00:00
|
|
|
* the VM page cache is not effected), can be changed via
|
|
|
|
* the kern.maxbcache /boot/loader.conf variable.
|
2001-08-20 00:41:12 +00:00
|
|
|
*/
|
|
|
|
#ifndef VM_BCACHE_SIZE_MAX
|
|
|
|
#define VM_BCACHE_SIZE_MAX (200 * 1024 * 1024)
|
|
|
|
#endif
|
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
/*
|
|
|
|
* Mach derived conversion macros
|
|
|
|
*/
|
1998-10-13 08:24:45 +00:00
|
|
|
#define trunc_page(x) ((x) & ~PAGE_MASK)
|
|
|
|
#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK)
|
2003-03-25 00:07:06 +00:00
|
|
|
#define trunc_4mpage(x) ((x) & ~PDRMASK)
|
|
|
|
#define round_4mpage(x) ((((x)) + PDRMASK) & ~PDRMASK)
|
1994-05-25 09:21:21 +00:00
|
|
|
|
2003-03-25 00:07:06 +00: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-31 04:19:00 +00:00
|
|
|
|
2003-03-25 00:07:06 +00:00
|
|
|
#define i386_btop(x) ((x) >> PAGE_SHIFT)
|
|
|
|
#define i386_ptob(x) ((x) << PAGE_SHIFT)
|
1993-10-12 07:13:12 +00:00
|
|
|
|
1999-02-19 19:34:49 +00:00
|
|
|
#define pgtok(x) ((x) * (PAGE_SIZE / 1024))
|
|
|
|
|
2009-09-08 20:45:40 +00:00
|
|
|
#endif /* !_I386_INCLUDE_PARAM_H_ */
|