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