m8820x_pte.h Source File

Back to the index.

m8820x_pte.h
Go to the documentation of this file.
1 /* $OpenBSD: mmu.h,v 1.8 2006/05/21 20:55:43 miod Exp $ */
2 
3 #ifndef M8820X_PTE_H
4 #define M8820X_PTE_H
5 
6 /*
7  * This file bears almost no resemblance to the original m68k file,
8  * so the following copyright notice is questionable, but we are
9  * nice people.
10  */
11 
12 /*
13  * Copyright (c) 1988 University of Utah.
14  * Copyright (c) 1982, 1986, 1990, 1993
15  * The Regents of the University of California. All rights reserved.
16  *
17  * This code is derived from software contributed to Berkeley by
18  * the Systems Programming Group of the University of Utah Computer
19  * Science Department.
20  *
21  * Redistribution and use in source and binary forms, with or without
22  * modification, are permitted provided that the following conditions
23  * are met:
24  * 1. Redistributions of source code must retain the above copyright
25  * notice, this list of conditions and the following disclaimer.
26  * 2. Redistributions in binary form must reproduce the above copyright
27  * notice, this list of conditions and the following disclaimer in the
28  * documentation and/or other materials provided with the distribution.
29  * 3. Neither the name of the University nor the names of its contributors
30  * may be used to endorse or promote products derived from this software
31  * without specific prior written permission.
32  *
33  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
34  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36  * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
37  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
41  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
42  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43  * SUCH DAMAGE.
44  *
45  * from: Utah $Hdr: pte.h 1.13 92/01/20$
46  *
47  * @(#)pte.h 8.1 (Berkeley) 6/10/93
48  */
49 
50 /*
51  * Parameters which determine the 'geometry' of the m88K page tables in memory.
52  */
53 
54 #define SDT_BITS 10 /* M88K segment table size bits */
55 #define PDT_BITS 10 /* M88K page table size bits */
56 #define PG_BITS PAGE_SHIFT /* M88K hardware page size bits */
57 
58 /*
59  * Common fields for APR, SDT and PTE
60  */
61 
62 /* address frame */
63 #define PG_FRAME 0xfffff000
64 #define PG_SHIFT PG_BITS
65 #define PG_PFNUM(x) (((x) & PG_FRAME) >> PG_SHIFT)
66 
67 /* cache control bits */
68 #define CACHE_DFL 0x00000000
69 #define CACHE_INH 0x00000040 /* cache inhibit */
70 #define CACHE_GLOBAL 0x00000080 /* global scope */
71 #define CACHE_WT 0x00000200 /* write through */
72 
73 #define CACHE_MASK (CACHE_INH | CACHE_GLOBAL | CACHE_WT)
74 
75 /*
76  * Area descriptors
77  */
78 
79 typedef u_int32_t apr_t;
80 
81 #define APR_V 0x00000001 /* valid bit */
82 
83 /*
84  * 88200 PATC (TLB)
85  */
86 
87 #define PATC_ENTRIES 56
88 
89 /*
90  * BATC entries
91  */
92 
93 #define BATC_V 0x00000001
94 #define BATC_PROT 0x00000002
95 #define BATC_INH 0x00000004
96 #define BATC_GLOBAL 0x00000008
97 #define BATC_WT 0x00000010
98 #define BATC_SO 0x00000020
99 
100 
101 /*
102  * Segment table entries
103  */
104 
105 typedef u_int32_t sdt_entry_t;
106 
107 #define SG_V 0x00000001
108 #define SG_NV 0x00000000
109 #define SG_PROT 0x00000004
110 #define SG_RO 0x00000004
111 #define SG_RW 0x00000000
112 #define SG_SO 0x00000100
113 
114 #define SDT_VALID(sdt) (*(sdt) & SG_V)
115 #define SDT_SUP(sdt) (*(sdt) & SG_SO)
116 #define SDT_WP(sdt) (*(sdt) & SG_PROT)
117 
118 /*
119  * Page table entries
120  */
121 
122 typedef u_int32_t pt_entry_t;
123 
124 #define PG_V 0x00000001
125 #define PG_NV 0x00000000
126 #define PG_PROT 0x00000004
127 #define PG_U 0x00000008
128 #define PG_M 0x00000010
129 #define PG_M_U 0x00000018
130 #define PG_RO 0x00000004
131 #define PG_RW 0x00000000
132 #define PG_SO 0x00000100
133 #define PG_W 0x00000020 /* XXX unused but reserved field */
134 #define PG_U0 0x00000400 /* U0 bit for M88110 */
135 #define PG_U1 0x00000800 /* U1 bit for M88110 */
136 
137 #define PDT_VALID(pte) (*(pte) & PG_V)
138 #define PDT_SUP(pte) (*(pte) & PG_SO)
139 #define PDT_WP(pte) (*(pte) & PG_PROT)
140 
141 /*
142  * Indirect descriptors (mc81110)
143  */
144 
145 typedef u_int32_t pt_ind_entry_t;
146 
147 /* validity bits */
148 #define IND_V 0x00000001
149 #define IND_NV 0x00000000
150 #define IND_MASKED 0x00000002
151 #define IND_UNMASKED 0x00000003
152 #define IND_MASK 0x00000003
153 
154 #define IND_FRAME 0xfffffffc
155 #define IND_SHIFT 2
156 
157 #define IND_PDA(x) ((x) & IND_FRAME >> IND_SHIFT)
158 
159 /*
160  * Number of entries in a page table.
161  */
162 
163 #define SDT_ENTRIES (1<<(SDT_BITS))
164 #define PDT_ENTRIES (1<<(PDT_BITS))
165 
166 /*
167  * Size in bytes of a single page table.
168  */
169 
170 #define SDT_SIZE (sizeof(sdt_entry_t) * SDT_ENTRIES)
171 #define PDT_SIZE (sizeof(pt_entry_t) * PDT_ENTRIES)
172 
173 /*
174  * Shifts and masks
175  */
176 
177 #define SDT_SHIFT (PDT_BITS + PG_BITS)
178 #define PDT_SHIFT (PG_BITS)
179 
180 #define SDT_MASK (((1 << SDT_BITS) - 1) << SDT_SHIFT)
181 #define PDT_MASK (((1 << PDT_BITS) - 1) << PDT_SHIFT)
182 
183 #define SDTIDX(va) (((va) & SDT_MASK) >> SDT_SHIFT)
184 #define PDTIDX(va) (((va) & PDT_MASK) >> PDT_SHIFT)
185 
186 /*
187  * Parameters and macros for BATC
188  */
189 
190 /* number of bits to BATC shift (log2(BATC_BLKBYTES)) */
191 #define BATC_BLKSHIFT 19
192 /* 'block' size of a BATC entry mapping */
193 #define BATC_BLKBYTES (1 << BATC_BLKSHIFT)
194 /* BATC block mask */
195 #define BATC_BLKMASK (BATC_BLKBYTES-1)
196 /* number of BATC entries */
197 #define BATC_MAX 8
198 
199 /* physical and logical block address */
200 #define BATC_PSHIFT 6
201 #define BATC_VSHIFT (BATC_PSHIFT + (32 - BATC_BLKSHIFT))
202 
203 #define BATC_BLK_ALIGNED(x) ((x & BATC_BLKMASK) == 0)
204 
205 #define M88K_BTOBLK(x) (x >> BATC_BLKSHIFT)
206 
207 #if 0
208 static pt_entry_t invalidate_pte(pt_entry_t *);
209 static __inline__ pt_entry_t
210 invalidate_pte(pt_entry_t *pte)
211 {
212  pt_entry_t oldpte;
213 
214  oldpte = PG_NV;
215  __asm__ __volatile__
216  ("xmem %0, %2, r0" : "=r"(oldpte) : "0"(oldpte), "r"(pte));
217  __asm__ __volatile__ ("tb1 0, r0, 0");
218  return oldpte;
219 }
220 #endif
221 
222 #endif /* M8820X_PTE_H */
pt_entry_t
u_int32_t pt_entry_t
Definition: m8820x_pte.h:122
pt_ind_entry_t
u_int32_t pt_ind_entry_t
Definition: m8820x_pte.h:145
apr_t
u_int32_t apr_t
Definition: m8820x_pte.h:79
PG_NV
#define PG_NV
Definition: m8820x_pte.h:125
sdt_entry_t
u_int32_t sdt_entry_t
Definition: m8820x_pte.h:105

Generated on Tue Mar 24 2020 14:04:48 for GXemul by doxygen 1.8.17