vmparam.h revision 139790
166458Sdfr/* $FreeBSD: head/sys/ia64/include/vmparam.h 139790 2005-01-06 22:18:23Z imp $ */
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/*
4766458Sdfr * USRTEXT is the start of the user text/data space, while USRSTACK
4866458Sdfr * is the top (end) of the user stack.  Immediately above the user stack
49115084Smarcel * resides the syscall gateway page.
5066458Sdfr */
5166458Sdfr#define	USRTEXT		CLBYTES
52115084Smarcel#define	USRSTACK	VM_MAX_ADDRESS
5366458Sdfr
5466458Sdfr/*
5566458Sdfr * Virtual memory related constants, all in bytes
5666458Sdfr */
5766458Sdfr#ifndef MAXTSIZ
5866458Sdfr#define	MAXTSIZ		(1<<30)			/* max text size (1G) */
5966458Sdfr#endif
6066458Sdfr#ifndef DFLDSIZ
6166458Sdfr#define	DFLDSIZ		(1<<27)			/* initial data size (128M) */
6266458Sdfr#endif
6366458Sdfr#ifndef MAXDSIZ
6466458Sdfr#define	MAXDSIZ		(1<<30)			/* max data size (1G) */
6566458Sdfr#endif
6666458Sdfr#ifndef	DFLSSIZ
6766458Sdfr#define	DFLSSIZ		(1<<21)			/* initial stack size (2M) */
6866458Sdfr#endif
6966458Sdfr#ifndef	MAXSSIZ
7092670Speter#define	MAXSSIZ		(1<<28)			/* max stack size (256M) */
7166458Sdfr#endif
7266458Sdfr#ifndef SGROWSIZ
7366458Sdfr#define SGROWSIZ	(128UL*1024)		/* amount to grow stack */
7466458Sdfr#endif
7566458Sdfr
7666458Sdfr/*
7766458Sdfr * PTEs for mapping user space into the kernel for phyio operations.
7866458Sdfr * 64 pte's are enough to cover 8 disks * MAXBSIZE.
7966458Sdfr */
8066458Sdfr#ifndef USRIOSIZE
8166458Sdfr#define USRIOSIZE	64
8266458Sdfr#endif
8366458Sdfr
8466458Sdfr/*
8566458Sdfr * Boundary at which to place first MAPMEM segment if not explicitly
8666458Sdfr * specified.  Should be a power of two.  This allows some slop for
8766458Sdfr * the data segment to grow underneath the first mapped segment.
8866458Sdfr */
8966458Sdfr#define MMSEG		0x200000
9066458Sdfr
9166458Sdfr/*
9266458Sdfr * The size of the clock loop.
9366458Sdfr */
9466458Sdfr#define	LOOPPAGES	(maxfree - firstfree)
9566458Sdfr
9666458Sdfr/*
9766458Sdfr * The time for a process to be blocked before being very swappable.
9866458Sdfr * This is a number of seconds which the system takes as being a non-trivial
9966458Sdfr * amount of real time.  You probably shouldn't change this;
10066458Sdfr * it is used in subtle ways (fractions and multiples of it are, that is, like
10166458Sdfr * half of a ``long time'', almost a long time, etc.)
10266458Sdfr * It is related to human patience and other factors which don't really
10366458Sdfr * change over time.
10466458Sdfr */
10566458Sdfr#define	MAXSLP 		20
10666458Sdfr
10766458Sdfr/*
10866458Sdfr * A swapped in process is given a small amount of core without being bothered
10966458Sdfr * by the page replacement algorithm.  Basically this says that if you are
11066458Sdfr * swapped in you deserve some resources.  We protect the last SAFERSS
11166458Sdfr * pages against paging and will just swap you out rather than paging you.
11266458Sdfr * Note that each process has at least UPAGES+CLSIZE pages which are not
11366458Sdfr * paged anyways, in addition to SAFERSS.
11466458Sdfr */
11566458Sdfr#define	SAFERSS		10		/* nominal ``small'' resident set size
11666458Sdfr					   protected against replacement */
11766458Sdfr
11866458Sdfr/*
119106486Smarcel * We need region 7 virtual addresses for pagetables.
120106486Smarcel */
121106486Smarcel#define UMA_MD_SMALL_ALLOC
122106486Smarcel
123106486Smarcel/*
12496912Smarcel * Manipulating region bits of an address.
12596912Smarcel */
12696912Smarcel#define IA64_RR_BASE(n)         (((u_int64_t) (n)) << 61)
12796912Smarcel#define IA64_RR_MASK(x)         ((x) & ((1L << 61) - 1))
12896912Smarcel
12996912Smarcel#define IA64_PHYS_TO_RR6(x)     ((x) | IA64_RR_BASE(6))
13096912Smarcel#define IA64_PHYS_TO_RR7(x)     ((x) | IA64_RR_BASE(7))
13196912Smarcel
13296912Smarcel/*
133119906Smarcel * Page size of the identity mappings in region 7.
134119906Smarcel */
135119906Smarcel#ifndef LOG2_ID_PAGE_SIZE
136119906Smarcel#define	LOG2_ID_PAGE_SIZE	28		/* 256M */
137119906Smarcel#endif
138119906Smarcel
139119906Smarcel#define	IA64_ID_PAGE_SHIFT	(LOG2_ID_PAGE_SIZE)
140119906Smarcel#define	IA64_ID_PAGE_SIZE	(1<<(LOG2_ID_PAGE_SIZE))
141119906Smarcel#define	IA64_ID_PAGE_MASK	(IA64_ID_PAGE_SIZE-1)
142119906Smarcel
143121268Smarcel#define	IA64_BACKINGSTORE	IA64_RR_BASE(4)
144121268Smarcel
145119906Smarcel/*
14666458Sdfr * Mach derived constants
14766458Sdfr */
14866458Sdfr
14966458Sdfr/* user/kernel map constants */
15066458Sdfr#define VM_MIN_ADDRESS		0
151115084Smarcel#define	VM_MAX_ADDRESS		IA64_RR_BASE(5)
152115084Smarcel#define	VM_GATEWAY_SIZE		PAGE_SIZE
153115084Smarcel#define	VM_MAXUSER_ADDRESS	(VM_MAX_ADDRESS + VM_GATEWAY_SIZE)
154115084Smarcel#define	VM_MIN_KERNEL_ADDRESS	VM_MAXUSER_ADDRESS
15566458Sdfr#define VM_MAX_KERNEL_ADDRESS	(IA64_RR_BASE(6) - 1)
15666458Sdfr
157115084Smarcel#define	KERNBASE		VM_MAX_ADDRESS
15896912Smarcel
15966458Sdfr/* virtual sizes (bytes) for various kernel submaps */
16066458Sdfr#ifndef VM_KMEM_SIZE
16166458Sdfr#define VM_KMEM_SIZE		(12 * 1024 * 1024)
16266458Sdfr#endif
16366458Sdfr
16466458Sdfr/*
16566458Sdfr * How many physical pages per KVA page allocated.
16666458Sdfr * min(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), VM_KMEM_SIZE_MAX)
16766458Sdfr * is the total KVA space allocated for kmem_map.
16866458Sdfr */
16966458Sdfr#ifndef VM_KMEM_SIZE_SCALE
17066458Sdfr#define	VM_KMEM_SIZE_SCALE	(4) /* XXX 8192 byte pages */
17166458Sdfr#endif
17266458Sdfr
17366458Sdfr/* initial pagein size of beginning of executable file */
17466458Sdfr#ifndef VM_INITIAL_PAGEIN
17566458Sdfr#define	VM_INITIAL_PAGEIN	16
17666458Sdfr#endif
17766458Sdfr
17896912Smarcel#endif	/* !_MACHINE_VMPARAM_H */
179