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