param.h revision 103436
1106113Sphk/*- 2106113Sphk * Copyright (c) 1990 The Regents of the University of California. 3106113Sphk * All rights reserved. 4106113Sphk * 5106113Sphk * This code is derived from software contributed to Berkeley by 6106113Sphk * William Jolitz. 7106113Sphk * 8106113Sphk * Redistribution and use in source and binary forms, with or without 9106113Sphk * modification, are permitted provided that the following conditions 10106113Sphk * are met: 11106113Sphk * 1. Redistributions of source code must retain the above copyright 12106113Sphk * notice, this list of conditions and the following disclaimer. 13106113Sphk * 2. Redistributions in binary form must reproduce the above copyright 14106113Sphk * notice, this list of conditions and the following disclaimer in the 15106113Sphk * documentation and/or other materials provided with the distribution. 16106113Sphk * 3. All advertising materials mentioning features or use of this software 17106113Sphk * must display the following acknowledgement: 18106113Sphk * This product includes software developed by the University of 19106113Sphk * California, Berkeley and its contributors. 20106113Sphk * 4. Neither the name of the University nor the names of its contributors 21106113Sphk * may be used to endorse or promote products derived from this software 22106113Sphk * without specific prior written permission. 23106113Sphk * 24106113Sphk * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25106113Sphk * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26106113Sphk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27106113Sphk * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28106113Sphk * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29106113Sphk * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30106113Sphk * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31106113Sphk * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32106113Sphk * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33106113Sphk * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34106113Sphk * SUCH DAMAGE. 35106113Sphk * 36106113Sphk * from: @(#)param.h 5.8 (Berkeley) 6/28/91 37106113Sphk * $FreeBSD: head/sys/i386/include/param.h 103436 2002-09-17 01:49:00Z peter $ 38106113Sphk */ 39106113Sphk 40106113Sphk/* 41106113Sphk * Machine dependent constants for Intel 386. 42106113Sphk */ 43106113Sphk 44106113Sphk/* 45106113Sphk * Round p (pointer or byte index) up to a correctly-aligned value 46106113Sphk * for all data types (int, long, ...). The result is unsigned int 47106113Sphk * and must be cast to any desired pointer type. 48106113Sphk */ 49106113Sphk#ifndef _ALIGNBYTES 50106113Sphk#define _ALIGNBYTES (sizeof(int) - 1) 51106113Sphk#endif 52106113Sphk#ifndef _ALIGN 53106113Sphk#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) 54106113Sphk#endif 55106113Sphk 56106113Sphk#ifndef _MACHINE 57106113Sphk#define _MACHINE i386 58106113Sphk#endif 59106113Sphk#ifndef _MACHINE_ARCH 60106113Sphk#define _MACHINE_ARCH i386 61106113Sphk#endif 62106113Sphk 63106113Sphk#ifndef _NO_NAMESPACE_POLLUTION 64106113Sphk 65106113Sphk#ifndef _MACHINE_PARAM_H_ 66106113Sphk#define _MACHINE_PARAM_H_ 67106113Sphk 68106113Sphk#ifndef MACHINE 69106113Sphk#define MACHINE "i386" 70106113Sphk#endif 71106113Sphk#ifndef MACHINE_ARCH 72106113Sphk#define MACHINE_ARCH "i386" 73106113Sphk#endif 74106113Sphk#define MID_MACHINE MID_I386 75106113Sphk 76106113Sphk#ifdef SMP 77106113Sphk#define MAXCPU 16 78106113Sphk#else 79106113Sphk#define MAXCPU 1 80106113Sphk#endif /* SMP */ 81106113Sphk 82106113Sphk#define ALIGNBYTES _ALIGNBYTES 83106113Sphk#define ALIGN(p) _ALIGN(p) 84106113Sphk 85106113Sphk#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ 86106113Sphk#define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */ 87106113Sphk#define PAGE_MASK (PAGE_SIZE-1) 88106113Sphk#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) 89106113Sphk 90106113Sphk#define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t))) 91106113Sphk#define PDRSHIFT 22 /* LOG2(NBPDR) */ 92106113Sphk#define NBPDR (1<<PDRSHIFT) /* bytes/page dir */ 93106113Sphk#define PDRMASK (NBPDR-1) 94106113Sphk 95#define IOPAGES 2 /* pages of i/o permission bitmap */ 96 97#ifndef KSTACK_PAGES 98#define KSTACK_PAGES 2 /* Includes pcb! */ 99#endif 100#define UAREA_PAGES 1 /* holds struct user WITHOUT PCB (see def.) */ 101 102#define KSTACK_GUARD /* compile in the kstack guard page */ 103 104/* 105 * Ceiling on amount of swblock kva space, can be changed via 106 * the kern.maxswzone /boot/loader.conf variable. 107 */ 108#ifndef VM_SWZONE_SIZE_MAX 109#define VM_SWZONE_SIZE_MAX (32 * 1024 * 1024) 110#endif 111 112/* 113 * Ceiling on size of buffer cache (really only effects write queueing, 114 * the VM page cache is not effected), can be changed via 115 * the kern.maxbcache /boot/loader.conf variable. 116 */ 117#ifndef VM_BCACHE_SIZE_MAX 118#define VM_BCACHE_SIZE_MAX (200 * 1024 * 1024) 119#endif 120 121/* 122 * Mach derived conversion macros 123 */ 124#define trunc_page(x) ((x) & ~PAGE_MASK) 125#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) 126#define trunc_4mpage(x) ((unsigned)(x) & ~PDRMASK) 127#define round_4mpage(x) ((((unsigned)(x)) + PDRMASK) & ~PDRMASK) 128 129#define atop(x) ((unsigned)(x) >> PAGE_SHIFT) 130#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) 131 132#define i386_btop(x) ((unsigned)(x) >> PAGE_SHIFT) 133#define i386_ptob(x) ((unsigned)(x) << PAGE_SHIFT) 134 135#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) 136 137#endif /* !_MACHINE_PARAM_H_ */ 138#endif /* !_NO_NAMESPACE_POLLUTION */ 139