Home | History | Annotate | Line # | Download | only in include
      1 /*	$NetBSD: vmparam.h,v 1.22 2016/09/03 09:07:53 christos Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2002 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by UCHIYAMA Yasushi.
      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  *
     19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  * POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 #ifndef _SH3_VMPARAM_H_
     33 #define	_SH3_VMPARAM_H_
     34 
     35 #include <sys/queue.h>
     36 
     37 #define __USE_TOPDOWN_VM
     38 
     39 /*
     40  * We use 4K pages on the sh3/sh4.  Override the PAGE_* definitions
     41  * to be compile-time constants.
     42  */
     43 #define	PAGE_SHIFT	12
     44 #define	PAGE_SIZE	(1 << PAGE_SHIFT)
     45 #define	PAGE_MASK	(PAGE_SIZE - 1)
     46 
     47 /* Virtual address map. */
     48 #define	VM_MIN_ADDRESS		((vaddr_t)0)
     49 #define	VM_MAXUSER_ADDRESS	((vaddr_t)0x7ffff000)
     50 #define	VM_MAX_ADDRESS		((vaddr_t)0x7ffff000)
     51 #define	VM_MIN_KERNEL_ADDRESS	((vaddr_t)0xc0000000)
     52 #define	VM_MAX_KERNEL_ADDRESS	((vaddr_t)0xe0000000)
     53 
     54 /* top of stack */
     55 #define	USRSTACK		VM_MAXUSER_ADDRESS
     56 
     57 /* Virtual memory resource limit. */
     58 #define	MAXTSIZ			(64 * 1024 * 1024)	/* max text size */
     59 #ifndef MAXDSIZ
     60 #define	MAXDSIZ			(512 * 1024 * 1024)	/* max data size */
     61 #endif
     62 #ifndef	MAXSSIZ
     63 #define	MAXSSIZ			(32 * 1024 * 1024)	/* max stack size */
     64 #endif
     65 
     66 /* initial data size limit */
     67 #ifndef DFLDSIZ
     68 #define	DFLDSIZ			(128 * 1024 * 1024)
     69 #endif
     70 /* initial stack size limit */
     71 #ifndef	DFLSSIZ
     72 #define	DFLSSIZ			(2 * 1024 * 1024)
     73 #endif
     74 
     75 /* Size of user raw I/O map */
     76 #ifndef USRIOSIZE
     77 #define	USRIOSIZE		(MAXBSIZE / PAGE_SIZE * 8)
     78 #endif
     79 
     80 #define	VM_PHYS_SIZE		(USRIOSIZE * PAGE_SIZE)
     81 
     82 /* Physical memory segments */
     83 #define	VM_PHYSSEG_STRAT	VM_PSTRAT_BSEARCH
     84 
     85 #define	sh3_round_page(x)	((((uint32_t)(x)) + PGOFSET) & ~PGOFSET)
     86 #define	sh3_trunc_page(x)	((uint32_t)(x) & ~PGOFSET)
     87 #define	sh3_btop(x)		((uint32_t)(x) >> PGSHIFT)
     88 #define	sh3_ptob(x)		((uint32_t)(x) << PGSHIFT)
     89 #endif /* !_SH3_VMPARAM_H_ */
     90