1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/include/machine/param.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,142 @@
1.4 +/*-
1.5 + * Copyright (c) 1990 The Regents of the University of California.
1.6 + * All rights reserved.
1.7 + *
1.8 + * This code is derived from software contributed to Berkeley by
1.9 + * William Jolitz.
1.10 + *
1.11 + * Redistribution and use in source and binary forms, with or without
1.12 + * modification, are permitted provided that the following conditions
1.13 + * are met:
1.14 + * 1. Redistributions of source code must retain the above copyright
1.15 + * notice, this list of conditions and the following disclaimer.
1.16 + * 2. Redistributions in binary form must reproduce the above copyright
1.17 + * notice, this list of conditions and the following disclaimer in the
1.18 + * documentation and/or other materials provided with the distribution.
1.19 + * 4. Neither the name of the University nor the names of its contributors
1.20 + * may be used to endorse or promote products derived from this software
1.21 + * without specific prior written permission.
1.22 + *
1.23 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1.24 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.25 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.26 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1.27 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1.28 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1.29 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.30 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1.31 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1.32 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1.33 + * SUCH DAMAGE.
1.34 + *
1.35 + * from: @(#)param.h 5.8 (Berkeley) 6/28/91
1.36 + * $FreeBSD: src/sys/i386/include/param.h,v 1.79 2004/11/20 02:29:49 das Exp $
1.37 + */
1.38 +
1.39 +/*
1.40 + * Machine dependent constants for Intel 386.
1.41 + */
1.42 +
1.43 +/*
1.44 + * Round p (pointer or byte index) up to a correctly-aligned value
1.45 + * for all data types (int, long, ...). The result is unsigned int
1.46 + * and must be cast to any desired pointer type.
1.47 + */
1.48 +
1.49 +#ifndef _ALIGNBYTES
1.50 +#define _ALIGNBYTES (sizeof(int) - 1)
1.51 +#endif
1.52 +#ifndef _ALIGN
1.53 +#define _ALIGN(p) (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
1.54 +#endif
1.55 +
1.56 +#ifndef _MACHINE
1.57 +#define _MACHINE i386
1.58 +#endif
1.59 +#ifndef _MACHINE_ARCH
1.60 +#define _MACHINE_ARCH i386
1.61 +#endif
1.62 +
1.63 +#ifndef _NO_NAMESPACE_POLLUTION
1.64 +
1.65 +#ifndef _MACHINE_PARAM_H_
1.66 +#define _MACHINE_PARAM_H_
1.67 +
1.68 +#ifndef MACHINE
1.69 +#define MACHINE "i386"
1.70 +#endif
1.71 +#ifndef MACHINE_ARCH
1.72 +#define MACHINE_ARCH "i386"
1.73 +#endif
1.74 +#define MID_MACHINE MID_I386
1.75 +
1.76 +#ifdef SMP
1.77 +#define MAXCPU 16
1.78 +#else
1.79 +#define MAXCPU 1
1.80 +#endif /* SMP */
1.81 +
1.82 +#define ALIGNBYTES _ALIGNBYTES
1.83 +#define ALIGN(p) _ALIGN(p)
1.84 +
1.85 +#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */
1.86 +#define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */
1.87 +#define PAGE_MASK (PAGE_SIZE-1)
1.88 +#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))
1.89 +
1.90 +#ifdef PAE
1.91 +#define NPGPTD 4
1.92 +#define PDRSHIFT 21 /* LOG2(NBPDR) */
1.93 +#else
1.94 +#define NPGPTD 1
1.95 +#define PDRSHIFT 22 /* LOG2(NBPDR) */
1.96 +#endif
1.97 +
1.98 +#define NBPTD (NPGPTD<<PAGE_SHIFT)
1.99 +#define NPDEPTD (NBPTD/(sizeof (pd_entry_t)))
1.100 +#define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t)))
1.101 +#define NBPDR (1<<PDRSHIFT) /* bytes/page dir */
1.102 +#define PDRMASK (NBPDR-1)
1.103 +
1.104 +#define IOPAGES 2 /* pages of i/o permission bitmap */
1.105 +
1.106 +#ifndef KSTACK_PAGES
1.107 +#define KSTACK_PAGES 2 /* Includes pcb! */
1.108 +#endif
1.109 +#define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */
1.110 +
1.111 +/*
1.112 + * Ceiling on amount of swblock kva space, can be changed via
1.113 + * the kern.maxswzone /boot/loader.conf variable.
1.114 + */
1.115 +#ifndef VM_SWZONE_SIZE_MAX
1.116 +#define VM_SWZONE_SIZE_MAX (32 * 1024 * 1024)
1.117 +#endif
1.118 +
1.119 +/*
1.120 + * Ceiling on size of buffer cache (really only effects write queueing,
1.121 + * the VM page cache is not effected), can be changed via
1.122 + * the kern.maxbcache /boot/loader.conf variable.
1.123 + */
1.124 +#ifndef VM_BCACHE_SIZE_MAX
1.125 +#define VM_BCACHE_SIZE_MAX (200 * 1024 * 1024)
1.126 +#endif
1.127 +
1.128 +/*
1.129 + * Mach derived conversion macros
1.130 + */
1.131 +#define trunc_page(x) ((x) & ~PAGE_MASK)
1.132 +#define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK)
1.133 +#define trunc_4mpage(x) ((x) & ~PDRMASK)
1.134 +#define round_4mpage(x) ((((x)) + PDRMASK) & ~PDRMASK)
1.135 +
1.136 +#define atop(x) ((x) >> PAGE_SHIFT)
1.137 +#define ptoa(x) ((x) << PAGE_SHIFT)
1.138 +
1.139 +#define i386_btop(x) ((x) >> PAGE_SHIFT)
1.140 +#define i386_ptob(x) ((x) << PAGE_SHIFT)
1.141 +
1.142 +#define pgtok(x) ((x) * (PAGE_SIZE / 1024))
1.143 +
1.144 +#endif /* !_MACHINE_PARAM_H_ */
1.145 +#endif /* !_NO_NAMESPACE_POLLUTION */