Home | History | Annotate | Line # | Download | only in include
pte.h revision 1.16
      1 /* $NetBSD: pte.h,v 1.16 1998/03/09 19:57:57 thorpej Exp $ */
      2 
      3 /*
      4  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
      5  * All rights reserved.
      6  *
      7  * Author: Chris G. Demetriou
      8  *
      9  * Permission to use, copy, modify and distribute this software and
     10  * its documentation is hereby granted, provided that both the copyright
     11  * notice and this permission notice appear in all copies of the
     12  * software, derivative works or modified versions, and any portions
     13  * thereof, and that both notices appear in supporting documentation.
     14  *
     15  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
     16  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
     17  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
     18  *
     19  * Carnegie Mellon requests users of this software to return to
     20  *
     21  *  Software Distribution Coordinator  or  Software.Distribution (at) CS.CMU.EDU
     22  *  School of Computer Science
     23  *  Carnegie Mellon University
     24  *  Pittsburgh PA 15213-3890
     25  *
     26  * any improvements or extensions that they make and grant Carnegie the
     27  * rights to redistribute these changes.
     28  */
     29 
     30 #ifndef _ALPHA_PTE_H_
     31 #define	_ALPHA_PTE_H_
     32 
     33 /*
     34  * Alpha page table entry.
     35  * Things which are in the VMS PALcode but not in the OSF PALcode
     36  * are marked with "(VMS)".
     37  *
     38  * This information derived from pp. (II) 3-3 - (II) 3-6 and
     39  * (III) 3-3 - (III) 3-5 of the "Alpha Architecture Reference Manual" by
     40  * Richard L. Sites.
     41  */
     42 
     43 /*
     44  * Alpha Page Table Entry
     45  */
     46 
     47 #include <machine/alpha_cpu.h>
     48 
     49 typedef	alpha_pt_entry_t	pt_entry_t;
     50 
     51 #define	PT_ENTRY_NULL	((pt_entry_t *) 0)
     52 #define	PTESHIFT	3			/* pte size == 1 << PTESHIFT */
     53 
     54 #define	NPTEPG_SHIFT	(PAGE_SHIFT - PTESHIFT)
     55 
     56 #define	PG_V		ALPHA_PTE_VALID
     57 #define	PG_NV		0
     58 #define	PG_FOR		ALPHA_PTE_FAULT_ON_READ
     59 #define	PG_FOW		ALPHA_PTE_FAULT_ON_WRITE
     60 #define	PG_FOE		ALPHA_PTE_FAULT_ON_EXECUTE
     61 #define	PG_ASM		ALPHA_PTE_ASM
     62 #define	PG_GH		ALPHA_PTE_GRANULARITY
     63 #define	PG_KRE		ALPHA_PTE_KR
     64 #define	PG_URE		ALPHA_PTE_UR
     65 #define	PG_KWE		ALPHA_PTE_KW
     66 #define	PG_UWE		ALPHA_PTE_UW
     67 #define	PG_PROT		ALPHA_PTE_PROT
     68 #define	PG_RSVD		0x000000000000cc80	/* Reserved fpr hardware */
     69 #define	PG_WIRED	0x0000000000010000	/* Wired. [SOFTWARE] */
     70 #define	PG_FRAME	ALPHA_PTE_RAME
     71 #define	PG_SHIFT	32
     72 #define	PG_PFNUM(x)	ALPHA_PTE_TO_PFN(x)
     73 
     74 #ifndef _LOCORE
     75 #define	PTEMASK		(NPTEPG - 1)
     76 #define	l3pte_index(va)	(((va) >> PGSHIFT) & PTEMASK)
     77 #define	l2pte_index(va)	(((va) >> SEGSHIFT) & PTEMASK)
     78 #define l1pte_index(va) \
     79 	(((vm_offset_t)(va) >> (PGSHIFT + 2*(PGSHIFT-PTESHIFT))) & PTEMASK)
     80 
     81 #define	ALPHA_STSIZE		((u_long)NBPG)			/* 8k */
     82 #define	ALPHA_MAX_PTSIZE	((u_long)(NPTEPG * NBPG))	/* 8M */
     83 
     84 #define	VPT_INDEX(va)	\
     85 	(((vm_offset_t)(va) >> PAGE_SHIFT) & ((1 << 3 * NPTEPG_SHIFT) - 1))
     86 
     87 #ifdef _KERNEL
     88 extern	pt_entry_t *Lev1map;		/* kernel level 1 page table */
     89 #endif /* _KERNEL */
     90 #endif /* ! _LOCORE */
     91 
     92 #endif /* ! _ALPHA_PTE_H_ */
     93