Home | History | Annotate | Line # | Download | only in include
pte.h revision 1.27.6.2
      1  1.27.6.1    skrll /* $NetBSD: pte.h,v 1.27.6.2 2004/09/18 14:31:03 skrll Exp $ */
      2      1.17  thorpej 
      3      1.17  thorpej /*-
      4      1.17  thorpej  * Copyright (c) 1998 The NetBSD Foundation, Inc.
      5      1.17  thorpej  * All rights reserved.
      6      1.17  thorpej  *
      7      1.17  thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8      1.17  thorpej  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9      1.17  thorpej  * NASA Ames Research Center.
     10      1.17  thorpej  *
     11      1.17  thorpej  * Redistribution and use in source and binary forms, with or without
     12      1.17  thorpej  * modification, are permitted provided that the following conditions
     13      1.17  thorpej  * are met:
     14      1.17  thorpej  * 1. Redistributions of source code must retain the above copyright
     15      1.17  thorpej  *    notice, this list of conditions and the following disclaimer.
     16      1.17  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     17      1.17  thorpej  *    notice, this list of conditions and the following disclaimer in the
     18      1.17  thorpej  *    documentation and/or other materials provided with the distribution.
     19      1.17  thorpej  * 3. All advertising materials mentioning features or use of this software
     20      1.17  thorpej  *    must display the following acknowledgement:
     21      1.17  thorpej  *	This product includes software developed by the NetBSD
     22      1.17  thorpej  *	Foundation, Inc. and its contributors.
     23      1.17  thorpej  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24      1.17  thorpej  *    contributors may be used to endorse or promote products derived
     25      1.17  thorpej  *    from this software without specific prior written permission.
     26      1.17  thorpej  *
     27      1.17  thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28      1.17  thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29      1.17  thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30      1.17  thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31      1.17  thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32      1.17  thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33      1.17  thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34      1.17  thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35      1.17  thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36      1.17  thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37      1.17  thorpej  * POSSIBILITY OF SUCH DAMAGE.
     38      1.17  thorpej  */
     39       1.1      cgd 
     40       1.1      cgd /*
     41       1.8      cgd  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
     42       1.1      cgd  * All rights reserved.
     43       1.1      cgd  *
     44       1.1      cgd  * Author: Chris G. Demetriou
     45       1.1      cgd  *
     46       1.1      cgd  * Permission to use, copy, modify and distribute this software and
     47       1.1      cgd  * its documentation is hereby granted, provided that both the copyright
     48       1.1      cgd  * notice and this permission notice appear in all copies of the
     49       1.1      cgd  * software, derivative works or modified versions, and any portions
     50       1.1      cgd  * thereof, and that both notices appear in supporting documentation.
     51       1.1      cgd  *
     52       1.1      cgd  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     53       1.1      cgd  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     54       1.1      cgd  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     55       1.1      cgd  *
     56       1.1      cgd  * Carnegie Mellon requests users of this software to return to
     57       1.1      cgd  *
     58       1.1      cgd  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     59       1.1      cgd  *  School of Computer Science
     60       1.1      cgd  *  Carnegie Mellon University
     61       1.1      cgd  *  Pittsburgh PA 15213-3890
     62       1.1      cgd  *
     63       1.1      cgd  * any improvements or extensions that they make and grant Carnegie the
     64       1.1      cgd  * rights to redistribute these changes.
     65       1.1      cgd  */
     66       1.1      cgd 
     67      1.14  thorpej #ifndef _ALPHA_PTE_H_
     68      1.14  thorpej #define	_ALPHA_PTE_H_
     69      1.14  thorpej 
     70       1.1      cgd /*
     71       1.1      cgd  * Alpha page table entry.
     72       1.1      cgd  * Things which are in the VMS PALcode but not in the OSF PALcode
     73       1.1      cgd  * are marked with "(VMS)".
     74       1.1      cgd  *
     75       1.1      cgd  * This information derived from pp. (II) 3-3 - (II) 3-6 and
     76       1.1      cgd  * (III) 3-3 - (III) 3-5 of the "Alpha Architecture Reference Manual" by
     77       1.1      cgd  * Richard L. Sites.
     78       1.1      cgd  */
     79       1.1      cgd 
     80       1.1      cgd /*
     81       1.1      cgd  * Alpha Page Table Entry
     82       1.1      cgd  */
     83       1.5      cgd 
     84       1.5      cgd #include <machine/alpha_cpu.h>
     85       1.5      cgd 
     86       1.5      cgd typedef	alpha_pt_entry_t	pt_entry_t;
     87       1.5      cgd 
     88       1.1      cgd #define	PTESHIFT	3			/* pte size == 1 << PTESHIFT */
     89       1.1      cgd 
     90       1.5      cgd #define	PG_V		ALPHA_PTE_VALID
     91       1.5      cgd #define	PG_NV		0
     92       1.5      cgd #define	PG_FOR		ALPHA_PTE_FAULT_ON_READ
     93       1.5      cgd #define	PG_FOW		ALPHA_PTE_FAULT_ON_WRITE
     94       1.5      cgd #define	PG_FOE		ALPHA_PTE_FAULT_ON_EXECUTE
     95       1.5      cgd #define	PG_ASM		ALPHA_PTE_ASM
     96       1.5      cgd #define	PG_GH		ALPHA_PTE_GRANULARITY
     97       1.5      cgd #define	PG_KRE		ALPHA_PTE_KR
     98       1.5      cgd #define	PG_URE		ALPHA_PTE_UR
     99       1.5      cgd #define	PG_KWE		ALPHA_PTE_KW
    100       1.5      cgd #define	PG_UWE		ALPHA_PTE_UW
    101  1.27.6.1    skrll #define	PG_PROT		(ALPHA_PTE_PROT | PG_EXEC | PG_FOE)
    102      1.22  thorpej #define	PG_RSVD		0x000000000000cc80	/* Reserved for hardware */
    103       1.1      cgd #define	PG_WIRED	0x0000000000010000	/* Wired. [SOFTWARE] */
    104      1.19  thorpej #define	PG_PVLIST	0x0000000000020000	/* on pv list [SOFTWARE] */
    105      1.22  thorpej #define	PG_EXEC		0x0000000000040000	/* execute perms [SOFTWARE] */
    106  1.27.6.1    skrll #define	PG_FRAME	ALPHA_PTE_PFN
    107       1.1      cgd #define	PG_SHIFT	32
    108       1.5      cgd #define	PG_PFNUM(x)	ALPHA_PTE_TO_PFN(x)
    109      1.23  thorpej 
    110      1.23  thorpej /*
    111      1.23  thorpej  * These are the PALcode PTE bits that we care about when checking to see
    112      1.26  thorpej  * if a PTE has changed in such a way as to require a TBI.
    113      1.23  thorpej  */
    114      1.26  thorpej #define	PG_PALCODE(x)	((x) & ALPHA_PTE_PALCODE)
    115       1.1      cgd 
    116      1.20  thorpej #if defined(_KERNEL) || defined(__KVM_ALPHA_PRIVATE)
    117      1.18  thorpej #define	NPTEPG_SHIFT	(PAGE_SHIFT - PTESHIFT)
    118      1.24  thorpej #define	NPTEPG		(1L << NPTEPG_SHIFT)
    119      1.18  thorpej 
    120       1.1      cgd #define	PTEMASK		(NPTEPG - 1)
    121      1.18  thorpej 
    122      1.18  thorpej #define	l3pte_index(va)	\
    123      1.25  thorpej 	(((vaddr_t)(va) >> PAGE_SHIFT) & PTEMASK)
    124      1.18  thorpej 
    125      1.18  thorpej #define	l2pte_index(va)	\
    126      1.25  thorpej 	(((vaddr_t)(va) >> (PAGE_SHIFT + NPTEPG_SHIFT)) & PTEMASK)
    127      1.18  thorpej 
    128      1.18  thorpej #define	l1pte_index(va) \
    129      1.25  thorpej 	(((vaddr_t)(va) >> (PAGE_SHIFT + 2 * NPTEPG_SHIFT)) & PTEMASK)
    130       1.1      cgd 
    131      1.16  thorpej #define	VPT_INDEX(va)	\
    132      1.25  thorpej 	(((vaddr_t)(va) >> PAGE_SHIFT) & ((1 << 3 * NPTEPG_SHIFT) - 1))
    133      1.17  thorpej 
    134      1.17  thorpej /* Space mapped by one level 1 PTE */
    135      1.17  thorpej #define	ALPHA_L1SEG_SIZE	(1L << ((2 * NPTEPG_SHIFT) + PAGE_SHIFT))
    136      1.17  thorpej 
    137      1.17  thorpej /* Space mapped by one level 2 PTE */
    138      1.17  thorpej #define	ALPHA_L2SEG_SIZE	(1L << (NPTEPG_SHIFT + PAGE_SHIFT))
    139      1.17  thorpej 
    140      1.17  thorpej #define	alpha_trunc_l1seg(x)	(((u_long)(x)) & ~(ALPHA_L1SEG_SIZE-1))
    141      1.17  thorpej #define	alpha_trunc_l2seg(x)	(((u_long)(x)) & ~(ALPHA_L2SEG_SIZE-1))
    142      1.20  thorpej #endif /* _KERNEL || __KVM_ALPHA_PRIVATE */
    143       1.1      cgd 
    144       1.3      cgd #ifdef _KERNEL
    145      1.21  thorpej extern	pt_entry_t *kernel_lev1map;	/* kernel level 1 page table */
    146      1.14  thorpej #endif /* _KERNEL */
    147      1.14  thorpej 
    148      1.14  thorpej #endif /* ! _ALPHA_PTE_H_ */
    149