pte.h revision 1.1 1 /* $NetBSD: pte.h,v 1.1 1998/05/15 10:15:55 tsubai Exp $ */
2
3 /*-
4 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
5 * Copyright (C) 1995, 1996 TooLs GmbH.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by TooLs GmbH.
19 * 4. The name of TooLs GmbH may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #ifndef _MACHINE_PTE_H_
35 #define _MACHINE_PTE_H_
36
37 #include <sys/queue.h>
38
39 /*
40 * Page Table Entries
41 */
42 #ifndef _LOCORE
43 struct pte {
44 u_int pte_hi;
45 u_int pte_lo;
46 };
47 #endif /* _LOCORE */
48 /* High word: */
49 #define PTE_VALID 0x80000000
50 #define PTE_VSID_SHFT 7
51 #define PTE_HID 0x00000040
52 #define PTE_API 0x0000003f
53 /* Low word: */
54 #define PTE_RPGN 0xfffff000
55 #define PTE_REF 0x00000100
56 #define PTE_CHG 0x00000080
57 #define PTE_WIMG 0x00000078
58 #define PTE_W 0x00000040
59 #define PTE_I 0x00000020
60 #define PTE_M 0x00000010
61 #define PTE_G 0x00000008
62 #define PTE_PP 0x00000003
63 #define PTE_RO 0x00000003
64 #define PTE_RW 0x00000002
65
66 #ifndef _LOCORE
67 typedef struct pte pte_t;
68 #endif /* _LOCORE */
69
70 /*
71 * Extract bits from address
72 */
73 #define ADDR_SR_SHFT 28
74 #define ADDR_PIDX 0x0ffff000
75 #define ADDR_PIDX_SHFT 12
76 #define ADDR_API_SHFT 22
77 #define ADDR_POFF 0x00000fff
78
79 #ifndef _LOCORE
80 #ifdef _KERNEL
81 extern pte_t *ptable;
82 extern int ptab_cnt;
83 #endif /* _KERNEL */
84 #endif /* _LOCORE */
85
86 /*
87 * Bits in DSISR:
88 */
89 #define DSISR_DIRECT 0x80000000
90 #define DSISR_NOTFOUND 0x40000000
91 #define DSISR_PROTECT 0x08000000
92 #define DSISR_INVRX 0x04000000
93 #define DSISR_STORE 0x02000000
94 #define DSISR_DABR 0x00400000
95 #define DSISR_SEGMENT 0x00200000
96 #define DSISR_EAR 0x00100000
97
98 /*
99 * Bits in SRR1 on ISI:
100 */
101 #define ISSRR1_NOTFOUND 0x40000000
102 #define ISSRR1_DIRECT 0x10000000
103 #define ISSRR1_PROTECT 0x08000000
104 #define ISSRR1_SEGMENT 0x00200000
105
106 #ifdef _KERNEL
107 #ifndef _LOCORE
108 extern u_int dsisr __P((void));
109 extern vm_offset_t dar __P((void));
110 #endif /* _KERNEL */
111 #endif /* _LOCORE */
112 #endif /* _MACHINE_PTE_H_ */
113