os/ossrv/genericopenlibs/openenvcore/include/machine/param.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*-
sl@0
     2
 * Copyright (c) 1990 The Regents of the University of California.
sl@0
     3
 * All rights reserved.
sl@0
     4
 *
sl@0
     5
 * This code is derived from software contributed to Berkeley by
sl@0
     6
 * William Jolitz.
sl@0
     7
 *
sl@0
     8
 * Redistribution and use in source and binary forms, with or without
sl@0
     9
 * modification, are permitted provided that the following conditions
sl@0
    10
 * are met:
sl@0
    11
 * 1. Redistributions of source code must retain the above copyright
sl@0
    12
 *    notice, this list of conditions and the following disclaimer.
sl@0
    13
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    14
 *    notice, this list of conditions and the following disclaimer in the
sl@0
    15
 *    documentation and/or other materials provided with the distribution.
sl@0
    16
 * 4. Neither the name of the University nor the names of its contributors
sl@0
    17
 *    may be used to endorse or promote products derived from this software
sl@0
    18
 *    without specific prior written permission.
sl@0
    19
 *
sl@0
    20
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
sl@0
    21
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0
    22
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0
    23
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
sl@0
    24
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sl@0
    25
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sl@0
    26
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    27
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
sl@0
    28
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
sl@0
    29
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
sl@0
    30
 * SUCH DAMAGE.
sl@0
    31
 *
sl@0
    32
 *	from: @(#)param.h	5.8 (Berkeley) 6/28/91
sl@0
    33
 * $FreeBSD: src/sys/i386/include/param.h,v 1.79 2004/11/20 02:29:49 das Exp $
sl@0
    34
 */
sl@0
    35
sl@0
    36
/*
sl@0
    37
 * Machine dependent constants for Intel 386.
sl@0
    38
 */
sl@0
    39
sl@0
    40
/*
sl@0
    41
 * Round p (pointer or byte index) up to a correctly-aligned value
sl@0
    42
 * for all data types (int, long, ...).   The result is unsigned int
sl@0
    43
 * and must be cast to any desired pointer type.
sl@0
    44
 */
sl@0
    45
sl@0
    46
#ifndef _ALIGNBYTES
sl@0
    47
#define _ALIGNBYTES	(sizeof(int) - 1)
sl@0
    48
#endif
sl@0
    49
#ifndef _ALIGN
sl@0
    50
#define _ALIGN(p)	(((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
sl@0
    51
#endif
sl@0
    52
sl@0
    53
#ifndef _MACHINE
sl@0
    54
#define	_MACHINE	i386
sl@0
    55
#endif
sl@0
    56
#ifndef _MACHINE_ARCH
sl@0
    57
#define	_MACHINE_ARCH	i386
sl@0
    58
#endif
sl@0
    59
sl@0
    60
#ifndef _NO_NAMESPACE_POLLUTION
sl@0
    61
sl@0
    62
#ifndef _MACHINE_PARAM_H_
sl@0
    63
#define	_MACHINE_PARAM_H_
sl@0
    64
sl@0
    65
#ifndef MACHINE
sl@0
    66
#define MACHINE		"i386"
sl@0
    67
#endif
sl@0
    68
#ifndef MACHINE_ARCH
sl@0
    69
#define	MACHINE_ARCH	"i386"
sl@0
    70
#endif
sl@0
    71
#define MID_MACHINE	MID_I386
sl@0
    72
sl@0
    73
#ifdef SMP
sl@0
    74
#define MAXCPU		16
sl@0
    75
#else
sl@0
    76
#define MAXCPU		1
sl@0
    77
#endif /* SMP */
sl@0
    78
sl@0
    79
#define ALIGNBYTES	_ALIGNBYTES
sl@0
    80
#define ALIGN(p)	_ALIGN(p)
sl@0
    81
sl@0
    82
#define PAGE_SHIFT	12		/* LOG2(PAGE_SIZE) */
sl@0
    83
#define PAGE_SIZE	(1<<PAGE_SHIFT)	/* bytes/page */
sl@0
    84
#define PAGE_MASK	(PAGE_SIZE-1)
sl@0
    85
#define NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t)))
sl@0
    86
sl@0
    87
#ifdef PAE
sl@0
    88
#define NPGPTD		4
sl@0
    89
#define PDRSHIFT	21		/* LOG2(NBPDR) */
sl@0
    90
#else
sl@0
    91
#define NPGPTD		1
sl@0
    92
#define PDRSHIFT	22		/* LOG2(NBPDR) */
sl@0
    93
#endif
sl@0
    94
sl@0
    95
#define NBPTD		(NPGPTD<<PAGE_SHIFT)
sl@0
    96
#define NPDEPTD		(NBPTD/(sizeof (pd_entry_t)))
sl@0
    97
#define NPDEPG		(PAGE_SIZE/(sizeof (pd_entry_t)))
sl@0
    98
#define NBPDR		(1<<PDRSHIFT)	/* bytes/page dir */
sl@0
    99
#define PDRMASK		(NBPDR-1)
sl@0
   100
sl@0
   101
#define IOPAGES	2		/* pages of i/o permission bitmap */
sl@0
   102
sl@0
   103
#ifndef KSTACK_PAGES
sl@0
   104
#define KSTACK_PAGES 2		/* Includes pcb! */
sl@0
   105
#endif
sl@0
   106
#define KSTACK_GUARD_PAGES 1	/* pages of kstack guard; 0 disables */
sl@0
   107
sl@0
   108
/*
sl@0
   109
 * Ceiling on amount of swblock kva space, can be changed via
sl@0
   110
 * the kern.maxswzone /boot/loader.conf variable.
sl@0
   111
 */
sl@0
   112
#ifndef VM_SWZONE_SIZE_MAX
sl@0
   113
#define VM_SWZONE_SIZE_MAX	(32 * 1024 * 1024)
sl@0
   114
#endif
sl@0
   115
sl@0
   116
/*
sl@0
   117
 * Ceiling on size of buffer cache (really only effects write queueing,
sl@0
   118
 * the VM page cache is not effected), can be changed via
sl@0
   119
 * the kern.maxbcache /boot/loader.conf variable.
sl@0
   120
 */
sl@0
   121
#ifndef VM_BCACHE_SIZE_MAX
sl@0
   122
#define VM_BCACHE_SIZE_MAX	(200 * 1024 * 1024)
sl@0
   123
#endif
sl@0
   124
sl@0
   125
/*
sl@0
   126
 * Mach derived conversion macros
sl@0
   127
 */
sl@0
   128
#define trunc_page(x)		((x) & ~PAGE_MASK)
sl@0
   129
#define round_page(x)		(((x) + PAGE_MASK) & ~PAGE_MASK)
sl@0
   130
#define trunc_4mpage(x)		((x) & ~PDRMASK)
sl@0
   131
#define round_4mpage(x)		((((x)) + PDRMASK) & ~PDRMASK)
sl@0
   132
sl@0
   133
#define atop(x)			((x) >> PAGE_SHIFT)
sl@0
   134
#define ptoa(x)			((x) << PAGE_SHIFT)
sl@0
   135
sl@0
   136
#define i386_btop(x)		((x) >> PAGE_SHIFT)
sl@0
   137
#define i386_ptob(x)		((x) << PAGE_SHIFT)
sl@0
   138
sl@0
   139
#define	pgtok(x)		((x) * (PAGE_SIZE / 1024))
sl@0
   140
sl@0
   141
#endif /* !_MACHINE_PARAM_H_ */
sl@0
   142
#endif /* !_NO_NAMESPACE_POLLUTION */