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