vmparam.h revision 172317
166458Sdfr/* $FreeBSD: head/sys/ia64/include/vmparam.h 172317 2007-09-25 06:25:06Z alc $ */
266458Sdfr/* From: NetBSD: vmparam.h,v 1.6 1997/09/23 23:23:23 mjacob Exp */
396912Smarcel#ifndef	_MACHINE_VMPARAM_H
496912Smarcel#define	_MACHINE_VMPARAM_H
5139790Simp/*-
666458Sdfr * Copyright (c) 1988 University of Utah.
766458Sdfr * Copyright (c) 1992, 1993
866458Sdfr *	The Regents of the University of California.  All rights reserved.
966458Sdfr *
1066458Sdfr * This code is derived from software contributed to Berkeley by
1166458Sdfr * the Systems Programming Group of the University of Utah Computer
1266458Sdfr * Science Department and Ralph Campbell.
1366458Sdfr *
1466458Sdfr * Redistribution and use in source and binary forms, with or without
1566458Sdfr * modification, are permitted provided that the following conditions
1666458Sdfr * are met:
1766458Sdfr * 1. Redistributions of source code must retain the above copyright
1866458Sdfr *    notice, this list of conditions and the following disclaimer.
1966458Sdfr * 2. Redistributions in binary form must reproduce the above copyright
2066458Sdfr *    notice, this list of conditions and the following disclaimer in the
2166458Sdfr *    documentation and/or other materials provided with the distribution.
2266458Sdfr * 4. Neither the name of the University nor the names of its contributors
2366458Sdfr *    may be used to endorse or promote products derived from this software
2466458Sdfr *    without specific prior written permission.
2566458Sdfr *
2666458Sdfr * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2766458Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2866458Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2966458Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3066458Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3166458Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3266458Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3366458Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3466458Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3566458Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3666458Sdfr * SUCH DAMAGE.
3766458Sdfr *
3866458Sdfr * from: Utah $Hdr: vmparam.h 1.16 91/01/18$
3966458Sdfr *
4066458Sdfr *	@(#)vmparam.h	8.2 (Berkeley) 4/22/94
4166458Sdfr */
4266458Sdfr
4366458Sdfr/*
4496912Smarcel * Machine dependent constants for ia64.
4566458Sdfr */
4666458Sdfr/*
47170033Salc * USRSTACK is the top (end) of the user stack.  Immediately above the user
48170033Salc * stack resides the syscall gateway page.
4966458Sdfr */
50115084Smarcel#define	USRSTACK	VM_MAX_ADDRESS
5166458Sdfr
5266458Sdfr/*
5366458Sdfr * Virtual memory related constants, all in bytes
5466458Sdfr */
5566458Sdfr#ifndef MAXTSIZ
5666458Sdfr#define	MAXTSIZ		(1<<30)			/* max text size (1G) */
5766458Sdfr#endif
5866458Sdfr#ifndef DFLDSIZ
5966458Sdfr#define	DFLDSIZ		(1<<27)			/* initial data size (128M) */
6066458Sdfr#endif
6166458Sdfr#ifndef MAXDSIZ
6266458Sdfr#define	MAXDSIZ		(1<<30)			/* max data size (1G) */
6366458Sdfr#endif
6466458Sdfr#ifndef	DFLSSIZ
6566458Sdfr#define	DFLSSIZ		(1<<21)			/* initial stack size (2M) */
6666458Sdfr#endif
6766458Sdfr#ifndef	MAXSSIZ
6892670Speter#define	MAXSSIZ		(1<<28)			/* max stack size (256M) */
6966458Sdfr#endif
7066458Sdfr#ifndef SGROWSIZ
7166458Sdfr#define SGROWSIZ	(128UL*1024)		/* amount to grow stack */
7266458Sdfr#endif
7366458Sdfr
7466458Sdfr/*
7566458Sdfr * Boundary at which to place first MAPMEM segment if not explicitly
7666458Sdfr * specified.  Should be a power of two.  This allows some slop for
7766458Sdfr * the data segment to grow underneath the first mapped segment.
7866458Sdfr */
7966458Sdfr#define MMSEG		0x200000
8066458Sdfr
8166458Sdfr/*
8266458Sdfr * The size of the clock loop.
8366458Sdfr */
8466458Sdfr#define	LOOPPAGES	(maxfree - firstfree)
8566458Sdfr
8666458Sdfr/*
8766458Sdfr * The time for a process to be blocked before being very swappable.
8866458Sdfr * This is a number of seconds which the system takes as being a non-trivial
8966458Sdfr * amount of real time.  You probably shouldn't change this;
9066458Sdfr * it is used in subtle ways (fractions and multiples of it are, that is, like
9166458Sdfr * half of a ``long time'', almost a long time, etc.)
9266458Sdfr * It is related to human patience and other factors which don't really
9366458Sdfr * change over time.
9466458Sdfr */
9566458Sdfr#define	MAXSLP 		20
9666458Sdfr
9766458Sdfr/*
9866458Sdfr * A swapped in process is given a small amount of core without being bothered
9966458Sdfr * by the page replacement algorithm.  Basically this says that if you are
10066458Sdfr * swapped in you deserve some resources.  We protect the last SAFERSS
10166458Sdfr * pages against paging and will just swap you out rather than paging you.
102150008Salc * Note that each process has at least UPAGES pages which are not
10366458Sdfr * paged anyways, in addition to SAFERSS.
10466458Sdfr */
10566458Sdfr#define	SAFERSS		10		/* nominal ``small'' resident set size
10666458Sdfr					   protected against replacement */
10766458Sdfr
10866458Sdfr/*
109106486Smarcel * We need region 7 virtual addresses for pagetables.
110106486Smarcel */
111106486Smarcel#define UMA_MD_SMALL_ALLOC
112106486Smarcel
113106486Smarcel/*
114169291Salc * The physical address space is sparsely populated.
115169291Salc */
116169291Salc#define	VM_PHYSSEG_SPARSE
117169291Salc
118169291Salc/*
119170519Salc * The number of PHYSSEG entries is equal to the number of phys_avail
120170519Salc * entries.
121170519Salc */
122170519Salc#define	VM_PHYSSEG_MAX		49
123170519Salc
124170519Salc/*
125172317Salc * Create three free page pools: VM_FREEPOOL_DEFAULT is the default pool
126170519Salc * from which physical pages are allocated and VM_FREEPOOL_DIRECT is
127170519Salc * the pool from which physical pages for small UMA objects are
128170519Salc * allocated.
129170519Salc */
130172317Salc#define	VM_NFREEPOOL		3
131172317Salc#define	VM_FREEPOOL_CACHE	2
132170519Salc#define	VM_FREEPOOL_DEFAULT	0
133170519Salc#define	VM_FREEPOOL_DIRECT	1
134170519Salc
135170519Salc/*
136170519Salc * Create one free page list.
137170519Salc */
138170519Salc#define	VM_NFREELIST		1
139170519Salc#define	VM_FREELIST_DEFAULT	0
140170519Salc
141170519Salc/*
142170519Salc * An allocation size of 256MB is supported in order to optimize the
143170519Salc * use of the identity mappings in region 7 by UMA.
144170519Salc */
145170519Salc#define	VM_NFREEORDER		16
146170519Salc
147170519Salc/*
14896912Smarcel * Manipulating region bits of an address.
14996912Smarcel */
15096912Smarcel#define IA64_RR_BASE(n)         (((u_int64_t) (n)) << 61)
15196912Smarcel#define IA64_RR_MASK(x)         ((x) & ((1L << 61) - 1))
15296912Smarcel
15396912Smarcel#define IA64_PHYS_TO_RR6(x)     ((x) | IA64_RR_BASE(6))
15496912Smarcel#define IA64_PHYS_TO_RR7(x)     ((x) | IA64_RR_BASE(7))
15596912Smarcel
15696912Smarcel/*
157119906Smarcel * Page size of the identity mappings in region 7.
158119906Smarcel */
159119906Smarcel#ifndef LOG2_ID_PAGE_SIZE
160119906Smarcel#define	LOG2_ID_PAGE_SIZE	28		/* 256M */
161119906Smarcel#endif
162119906Smarcel
163119906Smarcel#define	IA64_ID_PAGE_SHIFT	(LOG2_ID_PAGE_SIZE)
164119906Smarcel#define	IA64_ID_PAGE_SIZE	(1<<(LOG2_ID_PAGE_SIZE))
165119906Smarcel#define	IA64_ID_PAGE_MASK	(IA64_ID_PAGE_SIZE-1)
166119906Smarcel
167121268Smarcel#define	IA64_BACKINGSTORE	IA64_RR_BASE(4)
168121268Smarcel
169119906Smarcel/*
17066458Sdfr * Mach derived constants
17166458Sdfr */
17266458Sdfr
17366458Sdfr/* user/kernel map constants */
17466458Sdfr#define VM_MIN_ADDRESS		0
175115084Smarcel#define	VM_MAX_ADDRESS		IA64_RR_BASE(5)
176115084Smarcel#define	VM_GATEWAY_SIZE		PAGE_SIZE
177115084Smarcel#define	VM_MAXUSER_ADDRESS	(VM_MAX_ADDRESS + VM_GATEWAY_SIZE)
178115084Smarcel#define	VM_MIN_KERNEL_ADDRESS	VM_MAXUSER_ADDRESS
17966458Sdfr#define VM_MAX_KERNEL_ADDRESS	(IA64_RR_BASE(6) - 1)
18066458Sdfr
181115084Smarcel#define	KERNBASE		VM_MAX_ADDRESS
18296912Smarcel
18366458Sdfr/* virtual sizes (bytes) for various kernel submaps */
18466458Sdfr#ifndef VM_KMEM_SIZE
18566458Sdfr#define VM_KMEM_SIZE		(12 * 1024 * 1024)
18666458Sdfr#endif
18766458Sdfr
18866458Sdfr/*
18966458Sdfr * How many physical pages per KVA page allocated.
190168920Ssepotvin * min(max(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE),
191168920Ssepotvin *     VM_KMEM_SIZE_MIN), VM_KMEM_SIZE_MAX)
19266458Sdfr * is the total KVA space allocated for kmem_map.
19366458Sdfr */
19466458Sdfr#ifndef VM_KMEM_SIZE_SCALE
19566458Sdfr#define	VM_KMEM_SIZE_SCALE	(4) /* XXX 8192 byte pages */
19666458Sdfr#endif
19766458Sdfr
19866458Sdfr/* initial pagein size of beginning of executable file */
19966458Sdfr#ifndef VM_INITIAL_PAGEIN
20066458Sdfr#define	VM_INITIAL_PAGEIN	16
20166458Sdfr#endif
20266458Sdfr
20396912Smarcel#endif	/* !_MACHINE_VMPARAM_H */
204