1997-03-13 18:58:49 +03:00
|
|
|
/* $NetBSD: pte.h,v 1.14 1997/03/13 15:58:49 gwr Exp $ */
|
1994-10-26 12:07:55 +03:00
|
|
|
|
1996-11-20 21:56:49 +03:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
1993-08-28 19:35:16 +04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
1996-11-20 21:56:49 +03:00
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Adam Glass and Gordon W. Ross.
|
|
|
|
*
|
1993-08-28 19:35:16 +04:00
|
|
|
* 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:
|
1996-11-20 21:56:49 +03:00
|
|
|
* 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.
|
1993-08-28 19:35:16 +04:00
|
|
|
*
|
1996-11-20 21:56:49 +03:00
|
|
|
* 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
|
1997-01-27 22:40:46 +03:00
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
1996-11-20 21:56:49 +03:00
|
|
|
* 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.
|
1993-08-28 19:35:16 +04:00
|
|
|
*/
|
1993-07-30 21:02:44 +04:00
|
|
|
|
|
|
|
#ifndef _MACHINE_PTE_H
|
|
|
|
#define _MACHINE_PTE_H
|
|
|
|
|
1993-07-27 16:04:41 +04:00
|
|
|
#define NCONTEXT 8
|
|
|
|
#define SEGINV 255
|
|
|
|
#define NPAGSEG 16
|
|
|
|
#define NSEGMAP 2048
|
|
|
|
|
|
|
|
#define PG_VALID 0x80000000
|
|
|
|
#define PG_WRITE 0x40000000
|
|
|
|
#define PG_SYSTEM 0x20000000
|
|
|
|
#define PG_NC 0x10000000
|
|
|
|
#define PG_TYPE 0x0C000000
|
1994-11-22 00:26:40 +03:00
|
|
|
#define PG_REF 0x02000000
|
1993-07-27 16:04:41 +04:00
|
|
|
#define PG_MOD 0x01000000
|
1993-07-30 21:02:44 +04:00
|
|
|
|
1994-11-22 00:26:40 +03:00
|
|
|
#define PG_SPECIAL (PG_VALID|PG_WRITE|PG_SYSTEM|PG_NC|PG_REF|PG_MOD)
|
1993-07-30 21:02:44 +04:00
|
|
|
#define PG_PERM (PG_VALID|PG_WRITE|PG_SYSTEM|PG_NC)
|
1994-11-22 00:26:40 +03:00
|
|
|
#define PG_MODREF (PG_REF|PG_MOD)
|
1993-07-27 16:04:41 +04:00
|
|
|
#define PG_FRAME 0x0007FFFF
|
1993-07-30 21:02:44 +04:00
|
|
|
|
|
|
|
#define PG_MOD_SHIFT 24
|
|
|
|
#define PG_PERM_SHIFT 28
|
1993-07-27 16:04:41 +04:00
|
|
|
|
1994-11-22 00:26:40 +03:00
|
|
|
#define OBMEM 0
|
|
|
|
#define OBIO 1
|
|
|
|
#define VME_D16 2
|
|
|
|
#define VME_D32 3
|
1993-07-27 16:04:41 +04:00
|
|
|
#define PG_TYPE_SHIFT 26
|
|
|
|
|
1993-07-30 21:02:44 +04:00
|
|
|
#define PG_INVAL 0x0
|
|
|
|
|
1993-07-27 16:04:41 +04:00
|
|
|
#define MAKE_PGTYPE(x) ((x) << PG_TYPE_SHIFT)
|
|
|
|
#define PG_PGNUM(pte) (pte & PG_FRAME)
|
1993-07-30 21:02:44 +04:00
|
|
|
#define PG_PA(pte) ((pte & PG_FRAME) <<PGSHIFT)
|
|
|
|
|
1994-11-22 00:26:40 +03:00
|
|
|
#define PGT_MASK MAKE_PGTYPE(3)
|
|
|
|
#define PGT_OBMEM MAKE_PGTYPE(OBMEM) /* onboard memory */
|
|
|
|
#define PGT_OBIO MAKE_PGTYPE(OBIO) /* onboard I/O */
|
|
|
|
#define PGT_VME_D16 MAKE_PGTYPE(VME_D16) /* VMEbus 16-bit data */
|
|
|
|
#define PGT_VME_D32 MAKE_PGTYPE(VME_D32) /* VMEbus 32-bit data */
|
|
|
|
|
1996-05-05 08:18:28 +04:00
|
|
|
#define VA_SEGNUM(x) ((u_int)(x) >> SEGSHIFT)
|
|
|
|
|
1993-07-30 21:02:44 +04:00
|
|
|
#define VA_PTE_NUM_SHIFT 13
|
|
|
|
#define VA_PTE_NUM_MASK (0xF << VA_PTE_NUM_SHIFT)
|
|
|
|
#define VA_PTE_NUM(va) ((va & VA_PTE_NUM_MASK) >> VA_PTE_NUM_SHIFT)
|
|
|
|
|
1995-03-10 05:28:01 +03:00
|
|
|
#define PA_PGNUM(pa) ((unsigned)pa >> PGSHIFT)
|
1993-07-30 21:02:44 +04:00
|
|
|
|
1997-01-18 22:27:16 +03:00
|
|
|
/*
|
|
|
|
* Mach derived conversion macros
|
1997-03-13 18:58:49 +03:00
|
|
|
* Used only in sys/arch/_MACHINE
|
1997-01-18 22:27:16 +03:00
|
|
|
*/
|
1997-03-13 18:58:49 +03:00
|
|
|
#define _round_seg(x) ((((unsigned)(x)) + SEGOFSET) & ~SEGOFSET)
|
|
|
|
#define _trunc_seg(x) ((unsigned)(x) & ~SEGOFSET)
|
|
|
|
#define _btos(x) ((unsigned)(x) >> SEGSHIFT)
|
|
|
|
#define _stob(x) ((unsigned)(x) << SEGSHIFT)
|
|
|
|
|
|
|
|
#define _round_page(x) ((((unsigned)(x)) + PGOFSET) & ~PGOFSET)
|
|
|
|
#define _trunc_page(x) ((unsigned)(x) & ~PGOFSET)
|
|
|
|
#define _btop(x) ((unsigned)(x) >> PGSHIFT)
|
|
|
|
#define _ptob(x) ((unsigned)(x) << PGSHIFT)
|
1997-01-18 22:27:16 +03:00
|
|
|
|
1993-07-30 21:02:44 +04:00
|
|
|
#endif /* !_MACHINE_PTE_H*/
|