1998-03-12 04:21:21 +03:00
|
|
|
/* $NetBSD: pte.h,v 1.17 1998/03/12 01:21:21 thorpej Exp $ */
|
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
|
|
|
* NASA Ames Research Center.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
1995-02-14 02:06:39 +03:00
|
|
|
|
|
|
|
/*
|
1996-11-14 01:20:54 +03:00
|
|
|
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
1995-02-14 02:06:39 +03:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Author: Chris G. Demetriou
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify and distribute this software and
|
|
|
|
* its documentation is hereby granted, provided that both the copyright
|
|
|
|
* notice and this permission notice appear in all copies of the
|
|
|
|
* software, derivative works or modified versions, and any portions
|
|
|
|
* thereof, and that both notices appear in supporting documentation.
|
|
|
|
*
|
|
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
|
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
|
|
|
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
|
|
|
*
|
|
|
|
* Carnegie Mellon requests users of this software to return to
|
|
|
|
*
|
|
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
|
|
* School of Computer Science
|
|
|
|
* Carnegie Mellon University
|
|
|
|
* Pittsburgh PA 15213-3890
|
|
|
|
*
|
|
|
|
* any improvements or extensions that they make and grant Carnegie the
|
|
|
|
* rights to redistribute these changes.
|
|
|
|
*/
|
|
|
|
|
1998-03-07 04:44:08 +03:00
|
|
|
#ifndef _ALPHA_PTE_H_
|
|
|
|
#define _ALPHA_PTE_H_
|
|
|
|
|
1995-02-14 02:06:39 +03:00
|
|
|
/*
|
|
|
|
* Alpha page table entry.
|
|
|
|
* Things which are in the VMS PALcode but not in the OSF PALcode
|
|
|
|
* are marked with "(VMS)".
|
|
|
|
*
|
|
|
|
* This information derived from pp. (II) 3-3 - (II) 3-6 and
|
|
|
|
* (III) 3-3 - (III) 3-5 of the "Alpha Architecture Reference Manual" by
|
|
|
|
* Richard L. Sites.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Alpha Page Table Entry
|
|
|
|
*/
|
1996-07-09 04:39:24 +04:00
|
|
|
|
|
|
|
#include <machine/alpha_cpu.h>
|
|
|
|
|
|
|
|
typedef alpha_pt_entry_t pt_entry_t;
|
|
|
|
|
1995-02-14 02:06:39 +03:00
|
|
|
#define PT_ENTRY_NULL ((pt_entry_t *) 0)
|
|
|
|
#define PTESHIFT 3 /* pte size == 1 << PTESHIFT */
|
|
|
|
|
1998-03-09 22:57:57 +03:00
|
|
|
#define NPTEPG_SHIFT (PAGE_SHIFT - PTESHIFT)
|
|
|
|
|
1996-07-09 04:39:24 +04:00
|
|
|
#define PG_V ALPHA_PTE_VALID
|
|
|
|
#define PG_NV 0
|
|
|
|
#define PG_FOR ALPHA_PTE_FAULT_ON_READ
|
|
|
|
#define PG_FOW ALPHA_PTE_FAULT_ON_WRITE
|
|
|
|
#define PG_FOE ALPHA_PTE_FAULT_ON_EXECUTE
|
|
|
|
#define PG_ASM ALPHA_PTE_ASM
|
|
|
|
#define PG_GH ALPHA_PTE_GRANULARITY
|
|
|
|
#define PG_KRE ALPHA_PTE_KR
|
|
|
|
#define PG_URE ALPHA_PTE_UR
|
|
|
|
#define PG_KWE ALPHA_PTE_KW
|
|
|
|
#define PG_UWE ALPHA_PTE_UW
|
|
|
|
#define PG_PROT ALPHA_PTE_PROT
|
1995-02-14 02:06:39 +03:00
|
|
|
#define PG_RSVD 0x000000000000cc80 /* Reserved fpr hardware */
|
|
|
|
#define PG_WIRED 0x0000000000010000 /* Wired. [SOFTWARE] */
|
1996-07-09 04:39:24 +04:00
|
|
|
#define PG_FRAME ALPHA_PTE_RAME
|
1995-02-14 02:06:39 +03:00
|
|
|
#define PG_SHIFT 32
|
1996-07-09 04:39:24 +04:00
|
|
|
#define PG_PFNUM(x) ALPHA_PTE_TO_PFN(x)
|
1995-02-14 02:06:39 +03:00
|
|
|
|
1996-02-02 01:28:24 +03:00
|
|
|
#ifndef _LOCORE
|
1995-02-14 02:06:39 +03:00
|
|
|
#define PTEMASK (NPTEPG - 1)
|
1998-03-02 03:49:01 +03:00
|
|
|
#define l3pte_index(va) (((va) >> PGSHIFT) & PTEMASK)
|
|
|
|
#define l2pte_index(va) (((va) >> SEGSHIFT) & PTEMASK)
|
|
|
|
#define l1pte_index(va) \
|
1996-10-02 00:21:05 +04:00
|
|
|
(((vm_offset_t)(va) >> (PGSHIFT + 2*(PGSHIFT-PTESHIFT))) & PTEMASK)
|
|
|
|
|
1998-03-09 22:57:57 +03:00
|
|
|
#define VPT_INDEX(va) \
|
|
|
|
(((vm_offset_t)(va) >> PAGE_SHIFT) & ((1 << 3 * NPTEPG_SHIFT) - 1))
|
|
|
|
|
1998-03-12 04:21:21 +03:00
|
|
|
/* Space mapped by one level 1 PTE */
|
|
|
|
#define ALPHA_L1SEG_SIZE (1L << ((2 * NPTEPG_SHIFT) + PAGE_SHIFT))
|
|
|
|
|
|
|
|
/* Space mapped by one level 2 PTE */
|
|
|
|
#define ALPHA_L2SEG_SIZE (1L << (NPTEPG_SHIFT + PAGE_SHIFT))
|
|
|
|
|
|
|
|
#define alpha_trunc_l1seg(x) (((u_long)(x)) & ~(ALPHA_L1SEG_SIZE-1))
|
|
|
|
#define alpha_trunc_l2seg(x) (((u_long)(x)) & ~(ALPHA_L2SEG_SIZE-1))
|
|
|
|
|
1995-11-23 05:33:17 +03:00
|
|
|
#ifdef _KERNEL
|
1998-03-07 06:15:06 +03:00
|
|
|
extern pt_entry_t *Lev1map; /* kernel level 1 page table */
|
1998-03-07 04:44:08 +03:00
|
|
|
#endif /* _KERNEL */
|
|
|
|
#endif /* ! _LOCORE */
|
|
|
|
|
|
|
|
#endif /* ! _ALPHA_PTE_H_ */
|