machine/param.h

Go to the documentation of this file.
00001 /*-
00002  * Copyright (c) 1990 The Regents of the University of California.
00003  * All rights reserved.
00004  *
00005  * This code is derived from software contributed to Berkeley by
00006  * William Jolitz.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 4. Neither the name of the University nor the names of its contributors
00017  *    may be used to endorse or promote products derived from this software
00018  *    without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00021  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00022  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00023  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00024  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00025  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00026  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00027  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00028  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00029  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00030  * SUCH DAMAGE.
00031  *
00032  *      from: @(#)param.h       5.8 (Berkeley) 6/28/91
00033  * $FreeBSD: src/sys/i386/include/param.h,v 1.79 2004/11/20 02:29:49 das Exp $
00034  */
00035 
00036 /*
00037  * Machine dependent constants for Intel 386.
00038  */
00039 
00040 /*
00041  * Round p (pointer or byte index) up to a correctly-aligned value
00042  * for all data types (int, long, ...).   The result is unsigned int
00043  * and must be cast to any desired pointer type.
00044  */
00045  
00046 #ifndef _ALIGNBYTES
00047 #define _ALIGNBYTES     (sizeof(int) - 1)
00048 #endif
00049 #ifndef _ALIGN
00050 #define _ALIGN(p)       (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
00051 #endif
00052 
00053 #ifndef _MACHINE
00054 #define _MACHINE        i386
00055 #endif
00056 #ifndef _MACHINE_ARCH
00057 #define _MACHINE_ARCH   i386
00058 #endif
00059 
00060 #ifndef _NO_NAMESPACE_POLLUTION
00061 
00062 #ifndef _MACHINE_PARAM_H_
00063 #define _MACHINE_PARAM_H_
00064 
00065 #ifndef MACHINE
00066 #define MACHINE         "i386"
00067 #endif
00068 #ifndef MACHINE_ARCH
00069 #define MACHINE_ARCH    "i386"
00070 #endif
00071 #define MID_MACHINE     MID_I386
00072 
00073 #ifdef SMP
00074 #define MAXCPU          16
00075 #else
00076 #define MAXCPU          1
00077 #endif /* SMP */
00078 
00079 #define ALIGNBYTES      _ALIGNBYTES
00080 #define ALIGN(p)        _ALIGN(p)
00081 
00082 #define PAGE_SHIFT      12              /* LOG2(PAGE_SIZE) */
00083 #define PAGE_SIZE       (1<<PAGE_SHIFT) /* bytes/page */
00084 #define PAGE_MASK       (PAGE_SIZE-1)
00085 #define NPTEPG          (PAGE_SIZE/(sizeof (pt_entry_t)))
00086 
00087 #ifdef PAE
00088 #define NPGPTD          4
00089 #define PDRSHIFT        21              /* LOG2(NBPDR) */
00090 #else
00091 #define NPGPTD          1
00092 #define PDRSHIFT        22              /* LOG2(NBPDR) */
00093 #endif
00094 
00095 #define NBPTD           (NPGPTD<<PAGE_SHIFT)
00096 #define NPDEPTD         (NBPTD/(sizeof (pd_entry_t)))
00097 #define NPDEPG          (PAGE_SIZE/(sizeof (pd_entry_t)))
00098 #define NBPDR           (1<<PDRSHIFT)   /* bytes/page dir */
00099 #define PDRMASK         (NBPDR-1)
00100 
00101 #define IOPAGES 2               /* pages of i/o permission bitmap */
00102 
00103 #ifndef KSTACK_PAGES
00104 #define KSTACK_PAGES 2          /* Includes pcb! */
00105 #endif
00106 #define KSTACK_GUARD_PAGES 1    /* pages of kstack guard; 0 disables */
00107 
00108 /*
00109  * Ceiling on amount of swblock kva space, can be changed via
00110  * the kern.maxswzone /boot/loader.conf variable.
00111  */
00112 #ifndef VM_SWZONE_SIZE_MAX
00113 #define VM_SWZONE_SIZE_MAX      (32 * 1024 * 1024)
00114 #endif
00115 
00116 /*
00117  * Ceiling on size of buffer cache (really only effects write queueing,
00118  * the VM page cache is not effected), can be changed via
00119  * the kern.maxbcache /boot/loader.conf variable.
00120  */
00121 #ifndef VM_BCACHE_SIZE_MAX
00122 #define VM_BCACHE_SIZE_MAX      (200 * 1024 * 1024)
00123 #endif
00124 
00125 /*
00126  * Mach derived conversion macros
00127  */
00128 #define trunc_page(x)           ((x) & ~PAGE_MASK)
00129 #define round_page(x)           (((x) + PAGE_MASK) & ~PAGE_MASK)
00130 #define trunc_4mpage(x)         ((x) & ~PDRMASK)
00131 #define round_4mpage(x)         ((((x)) + PDRMASK) & ~PDRMASK)
00132 
00133 #define atop(x)                 ((x) >> PAGE_SHIFT)
00134 #define ptoa(x)                 ((x) << PAGE_SHIFT)
00135 
00136 #define i386_btop(x)            ((x) >> PAGE_SHIFT)
00137 #define i386_ptob(x)            ((x) << PAGE_SHIFT)
00138 
00139 #define pgtok(x)                ((x) * (PAGE_SIZE / 1024))
00140 
00141 #endif /* !_MACHINE_PARAM_H_ */
00142 #endif /* !_NO_NAMESPACE_POLLUTION */

Copyright © Nokia Corporation 2001-2008
Back to top