Home | History | Annotate | Line # | Download | only in include
vmparam.h revision 1.1.2.2
      1 /*	$NetBSD: vmparam.h,v 1.1.2.2 2006/04/11 11:53:35 yamt Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1990 The Regents of the University of California.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to Berkeley by
      8  * William Jolitz.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. Neither the name of the University nor the names of its contributors
     19  *    may be used to endorse or promote products derived from this software
     20  *    without specific prior written permission.
     21  *
     22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  * SUCH DAMAGE.
     33  *
     34  *	@(#)vmparam.h	5.9 (Berkeley) 5/12/91
     35  */
     36 
     37 #ifndef _VMPARAM_H_
     38 #define _VMPARAM_H_
     39 
     40 #include <sys/tree.h>
     41 
     42 #define	USRSTACK	VM_MAX_ADDRESS /* XXX: Revisit vm address space. */
     43 
     44 /*
     45  * Virtual memory related constants, all in bytes
     46  */
     47 #ifndef MAXTSIZ
     48 #define	MAXTSIZ		(1<<30)			/* max text size (1G) */
     49 #endif
     50 #ifndef DFLDSIZ
     51 #define	DFLDSIZ		(1<<27)			/* initial data size (128M) */
     52 #endif
     53 #ifndef MAXDSIZ
     54 #define	MAXDSIZ		(1<<30)			/* max data size (1G) */
     55 #endif
     56 #ifndef	DFLSSIZ
     57 #define	DFLSSIZ		(1<<21)			/* initial stack size (2M) */
     58 #endif
     59 #ifndef	MAXSSIZ
     60 #define	MAXSSIZ		(1<<28)			/* max stack size (256M) */
     61 #endif
     62 #ifndef SGROWSIZ
     63 #define SGROWSIZ	(128UL*1024)		/* amount to grow stack */
     64 #endif
     65 
     66 
     67 
     68 /*
     69  * PTEs for mapping user space into the kernel for phyio operations.
     70  * 64 pte's are enough to cover 8 disks * MAXBSIZE.
     71  */
     72 #ifndef USRIOSIZE
     73 #define USRIOSIZE	64
     74 #endif
     75 
     76 /*
     77  * Manipulating region bits of an address.
     78  */
     79 #define IA64_RR_BASE(n)         (((u_int64_t) (n)) << 61)
     80 #define IA64_RR_MASK(x)         ((x) & ((1L << 61) - 1))
     81 
     82 #define IA64_PHYS_TO_RR6(x)     ((x) | IA64_RR_BASE(6))
     83 #define IA64_PHYS_TO_RR7(x)     ((x) | IA64_RR_BASE(7))
     84 
     85 #define	IA64_ID_PAGE_SHIFT	28		/* 256M */
     86 #define	IA64_ID_PAGE_SIZE	(1 << IA64_ID_PAGE_SHIFT)
     87 #define	IA64_ID_PAGE_MASK	(IA64_ID_PAGE_SIZE-1)
     88 
     89 #define	PAGE_SHIFT	14		/* 16K pages by default. */
     90 #define	PAGE_SIZE	(1 << PAGE_SHIFT)
     91 #define	PAGE_MASK	(PAGE_SIZE - 1)
     92 
     93 /* user/kernel map constants */
     94 #define VM_MIN_ADDRESS		((vaddr_t)0)
     95 #define	VM_MAX_ADDRESS		((vaddr_t) IA64_RR_BASE(5))
     96 #define	VM_GATEWAY_SIZE		PAGE_SIZE
     97 #define	VM_MAXUSER_ADDRESS	(VM_MAX_ADDRESS + VM_GATEWAY_SIZE)
     98 #define	VM_MIN_KERNEL_ADDRESS	VM_MAXUSER_ADDRESS
     99 #define VM_MAX_KERNEL_ADDRESS	((vaddr_t) (IA64_RR_BASE(6) - 1))
    100 
    101 #define VM_PHYSSEG_MAX		16		/* XXX: */
    102 #define VM_PHYSSEG_STRAT	VM_PSTRAT_BSEARCH
    103 #define	VM_PHYSSEG_NOADD			/* no more after vm_mem_init */
    104 
    105 #define	VM_NFREELIST		1 /* XXX: */
    106 #define	VM_FREELIST_DEFAULT	0 /* XXX: */
    107 
    108 /* virtual sizes (bytes) for various kernel submaps */
    109 #define VM_PHYS_SIZE		(USRIOSIZE*PAGE_SIZE)
    110 
    111 #ifndef _LOCORE
    112 /*
    113  * pmap-specific data store in the vm_page structure.
    114  */
    115 #define	__HAVE_VM_PAGE_MD
    116 struct vm_page_md {
    117 	TAILQ_HEAD(,pv_entry) pv_list;		/* pv_entry list */
    118 	int pv_list_count;
    119 	struct simplelock pv_slock;		/* lock on this head */
    120 	int pvh_attrs;				/* page attributes */
    121 };
    122 
    123 #define	VM_MDPAGE_INIT(pg)						\
    124 do {									\
    125 	TAILQ_INIT(&(pg)->mdpage.pv_list);				\
    126 	simple_lock_init(&(pg)->mdpage.pv_slock);			\
    127 } while (/*CONSTCOND*/0)
    128 #endif /*_LOCORE*/
    129 
    130 #endif /* _VMPARAM_H_ */
    131