cpuregs.h revision 1.2 1 1.1 deraadt /*
2 1.2 glass * Copyright (c) 1992, 1993
3 1.2 glass * The Regents of the University of California. All rights reserved.
4 1.1 deraadt *
5 1.1 deraadt * This code is derived from software contributed to Berkeley by
6 1.1 deraadt * Ralph Campbell and Rick Macklem.
7 1.1 deraadt *
8 1.1 deraadt * Redistribution and use in source and binary forms, with or without
9 1.1 deraadt * modification, are permitted provided that the following conditions
10 1.1 deraadt * are met:
11 1.1 deraadt * 1. Redistributions of source code must retain the above copyright
12 1.1 deraadt * notice, this list of conditions and the following disclaimer.
13 1.1 deraadt * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 deraadt * notice, this list of conditions and the following disclaimer in the
15 1.1 deraadt * documentation and/or other materials provided with the distribution.
16 1.1 deraadt * 3. All advertising materials mentioning features or use of this software
17 1.1 deraadt * must display the following acknowledgement:
18 1.1 deraadt * This product includes software developed by the University of
19 1.1 deraadt * California, Berkeley and its contributors.
20 1.1 deraadt * 4. Neither the name of the University nor the names of its contributors
21 1.1 deraadt * may be used to endorse or promote products derived from this software
22 1.1 deraadt * without specific prior written permission.
23 1.1 deraadt *
24 1.1 deraadt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 1.1 deraadt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 1.1 deraadt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 1.1 deraadt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 1.1 deraadt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 1.1 deraadt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 1.1 deraadt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 1.1 deraadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 1.1 deraadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 1.1 deraadt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 1.1 deraadt * SUCH DAMAGE.
35 1.1 deraadt *
36 1.2 glass * from: @(#)machConst.h 8.1 (Berkeley) 6/10/93
37 1.2 glass * $Id: cpuregs.h,v 1.2 1994/05/27 08:40:42 glass Exp $
38 1.1 deraadt *
39 1.1 deraadt * machConst.h --
40 1.1 deraadt *
41 1.1 deraadt * Machine dependent constants.
42 1.1 deraadt *
43 1.1 deraadt * Copyright (C) 1989 Digital Equipment Corporation.
44 1.1 deraadt * Permission to use, copy, modify, and distribute this software and
45 1.1 deraadt * its documentation for any purpose and without fee is hereby granted,
46 1.1 deraadt * provided that the above copyright notice appears in all copies.
47 1.1 deraadt * Digital Equipment Corporation makes no representations about the
48 1.1 deraadt * suitability of this software for any purpose. It is provided "as is"
49 1.1 deraadt * without express or implied warranty.
50 1.1 deraadt *
51 1.1 deraadt * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machConst.h,
52 1.2 glass * v 9.2 89/10/21 15:55:22 jhh Exp SPRITE (DECWRL)
53 1.1 deraadt * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAddrs.h,
54 1.2 glass * v 1.2 89/08/15 18:28:21 rab Exp SPRITE (DECWRL)
55 1.1 deraadt * from: Header: /sprite/src/kernel/vm/ds3100.md/RCS/vmPmaxConst.h,
56 1.2 glass * v 9.1 89/09/18 17:33:00 shirriff Exp SPRITE (DECWRL)
57 1.2 glass * $Id: cpuregs.h,v 1.2 1994/05/27 08:40:42 glass Exp $
58 1.1 deraadt */
59 1.1 deraadt
60 1.1 deraadt #ifndef _MACHCONST
61 1.1 deraadt #define _MACHCONST
62 1.1 deraadt
63 1.1 deraadt #define MACH_KUSEG_ADDR 0x0
64 1.1 deraadt #define MACH_CACHED_MEMORY_ADDR 0x80000000
65 1.1 deraadt #define MACH_UNCACHED_MEMORY_ADDR 0xa0000000
66 1.1 deraadt #define MACH_KSEG2_ADDR 0xc0000000
67 1.1 deraadt #define MACH_MAX_MEM_ADDR 0xbe000000
68 1.1 deraadt #define MACH_RESERVED_ADDR 0xbfc80000
69 1.1 deraadt
70 1.1 deraadt #define MACH_CACHED_TO_PHYS(x) ((unsigned)(x) & 0x1fffffff)
71 1.1 deraadt #define MACH_PHYS_TO_CACHED(x) ((unsigned)(x) | MACH_CACHED_MEMORY_ADDR)
72 1.1 deraadt #define MACH_UNCACHED_TO_PHYS(x) ((unsigned)(x) & 0x1fffffff)
73 1.1 deraadt #define MACH_PHYS_TO_UNCACHED(x) ((unsigned)(x) | MACH_UNCACHED_MEMORY_ADDR)
74 1.1 deraadt
75 1.1 deraadt #define MACH_CODE_START 0x80030000
76 1.1 deraadt
77 1.1 deraadt /*
78 1.1 deraadt * The bits in the cause register.
79 1.1 deraadt *
80 1.1 deraadt * MACH_CR_BR_DELAY Exception happened in branch delay slot.
81 1.1 deraadt * MACH_CR_COP_ERR Coprocessor error.
82 1.1 deraadt * Interrupt pending bits defined below.
83 1.1 deraadt * MACH_CR_EXC_CODE The exception type (see exception codes below).
84 1.1 deraadt */
85 1.1 deraadt #define MACH_CR_BR_DELAY 0x80000000
86 1.1 deraadt #define MACH_CR_COP_ERR 0x30000000
87 1.1 deraadt #define MACH_CR_EXC_CODE 0x0000003C
88 1.1 deraadt #define MACH_CR_EXC_CODE_SHIFT 2
89 1.1 deraadt
90 1.1 deraadt /*
91 1.1 deraadt * The bits in the status register. All bits are active when set to 1.
92 1.1 deraadt *
93 1.1 deraadt * MACH_SR_CO_USABILITY Control the usability of the four coprocessors.
94 1.1 deraadt * MACH_SR_BOOT_EXC_VEC Use alternate exception vectors.
95 1.1 deraadt * MACH_SR_TLB_SHUTDOWN TLB disabled.
96 1.1 deraadt * MACH_SR_PARITY_ERR Parity error.
97 1.1 deraadt * MACH_SR_CACHE_MISS Most recent D-cache load resulted in a miss.
98 1.1 deraadt * MACH_SR_PARITY_ZERO Zero replaces outgoing parity bits.
99 1.1 deraadt * MACH_SR_SWAP_CACHES Swap I-cache and D-cache.
100 1.1 deraadt * MACH_SR_ISOL_CACHES Isolate D-cache from main memory.
101 1.1 deraadt * Interrupt enable bits defined below.
102 1.1 deraadt * MACH_SR_KU_OLD Old kernel/user mode bit. 1 => user mode.
103 1.1 deraadt * MACH_SR_INT_ENA_OLD Old interrupt enable bit.
104 1.1 deraadt * MACH_SR_KU_PREV Previous kernel/user mode bit. 1 => user mode.
105 1.1 deraadt * MACH_SR_INT_ENA_PREV Previous interrupt enable bit.
106 1.1 deraadt * MACH_SR_KU_CUR Current kernel/user mode bit. 1 => user mode.
107 1.1 deraadt * MACH_SR_INT_ENA_CUR Current interrupt enable bit.
108 1.1 deraadt */
109 1.1 deraadt #define MACH_SR_COP_USABILITY 0xf0000000
110 1.1 deraadt #define MACH_SR_COP_0_BIT 0x10000000
111 1.1 deraadt #define MACH_SR_COP_1_BIT 0x20000000
112 1.1 deraadt #define MACH_SR_BOOT_EXC_VEC 0x00400000
113 1.1 deraadt #define MACH_SR_TLB_SHUTDOWN 0x00200000
114 1.1 deraadt #define MACH_SR_PARITY_ERR 0x00100000
115 1.1 deraadt #define MACH_SR_CACHE_MISS 0x00080000
116 1.1 deraadt #define MACH_SR_PARITY_ZERO 0x00040000
117 1.1 deraadt #define MACH_SR_SWAP_CACHES 0x00020000
118 1.1 deraadt #define MACH_SR_ISOL_CACHES 0x00010000
119 1.1 deraadt #define MACH_SR_KU_OLD 0x00000020
120 1.1 deraadt #define MACH_SR_INT_ENA_OLD 0x00000010
121 1.1 deraadt #define MACH_SR_KU_PREV 0x00000008
122 1.1 deraadt #define MACH_SR_INT_ENA_PREV 0x00000004
123 1.1 deraadt #define MACH_SR_KU_CUR 0x00000002
124 1.1 deraadt #define MACH_SR_INT_ENA_CUR 0x00000001
125 1.1 deraadt #define MACH_SR_MBZ 0x0f8000c0
126 1.1 deraadt
127 1.1 deraadt /*
128 1.1 deraadt * The interrupt masks.
129 1.1 deraadt * If a bit in the mask is 1 then the interrupt is enabled (or pending).
130 1.1 deraadt */
131 1.1 deraadt #define MACH_INT_MASK 0xff00
132 1.1 deraadt #define MACH_INT_MASK_5 0x8000
133 1.1 deraadt #define MACH_INT_MASK_4 0x4000
134 1.1 deraadt #define MACH_INT_MASK_3 0x2000
135 1.1 deraadt #define MACH_INT_MASK_2 0x1000
136 1.1 deraadt #define MACH_INT_MASK_1 0x0800
137 1.1 deraadt #define MACH_INT_MASK_0 0x0400
138 1.1 deraadt #define MACH_HARD_INT_MASK 0xfc00
139 1.1 deraadt #define MACH_SOFT_INT_MASK_1 0x0200
140 1.1 deraadt #define MACH_SOFT_INT_MASK_0 0x0100
141 1.1 deraadt
142 1.1 deraadt /*
143 1.1 deraadt * The bits in the context register.
144 1.1 deraadt */
145 1.1 deraadt #define MACH_CNTXT_PTE_BASE 0xFFE00000
146 1.1 deraadt #define MACH_CNTXT_BAD_VPN 0x001FFFFC
147 1.1 deraadt
148 1.1 deraadt /*
149 1.1 deraadt * Location of exception vectors.
150 1.1 deraadt */
151 1.1 deraadt #define MACH_RESET_EXC_VEC 0xBFC00000
152 1.1 deraadt #define MACH_UTLB_MISS_EXC_VEC 0x80000000
153 1.1 deraadt #define MACH_GEN_EXC_VEC 0x80000080
154 1.1 deraadt
155 1.1 deraadt /*
156 1.1 deraadt * Coprocessor 0 registers:
157 1.1 deraadt *
158 1.1 deraadt * MACH_COP_0_TLB_INDEX TLB index.
159 1.1 deraadt * MACH_COP_0_TLB_RANDOM TLB random.
160 1.1 deraadt * MACH_COP_0_TLB_LOW TLB entry low.
161 1.1 deraadt * MACH_COP_0_TLB_CONTEXT TLB context.
162 1.1 deraadt * MACH_COP_0_BAD_VADDR Bad virtual address.
163 1.1 deraadt * MACH_COP_0_TLB_HI TLB entry high.
164 1.1 deraadt * MACH_COP_0_STATUS_REG Status register.
165 1.1 deraadt * MACH_COP_0_CAUSE_REG Exception cause register.
166 1.1 deraadt * MACH_COP_0_EXC_PC Exception PC.
167 1.1 deraadt * MACH_COP_0_PRID Processor revision identifier.
168 1.1 deraadt */
169 1.1 deraadt #define MACH_COP_0_TLB_INDEX $0
170 1.1 deraadt #define MACH_COP_0_TLB_RANDOM $1
171 1.1 deraadt #define MACH_COP_0_TLB_LOW $2
172 1.1 deraadt #define MACH_COP_0_TLB_CONTEXT $4
173 1.1 deraadt #define MACH_COP_0_BAD_VADDR $8
174 1.1 deraadt #define MACH_COP_0_TLB_HI $10
175 1.1 deraadt #define MACH_COP_0_STATUS_REG $12
176 1.1 deraadt #define MACH_COP_0_CAUSE_REG $13
177 1.1 deraadt #define MACH_COP_0_EXC_PC $14
178 1.1 deraadt #define MACH_COP_0_PRID $15
179 1.1 deraadt
180 1.1 deraadt /*
181 1.1 deraadt * Values for the code field in a break instruction.
182 1.1 deraadt */
183 1.1 deraadt #define MACH_BREAK_INSTR 0x0000000d
184 1.1 deraadt #define MACH_BREAK_VAL_MASK 0x03ff0000
185 1.1 deraadt #define MACH_BREAK_VAL_SHIFT 16
186 1.1 deraadt #define MACH_BREAK_KDB_VAL 512
187 1.1 deraadt #define MACH_BREAK_SSTEP_VAL 513
188 1.1 deraadt #define MACH_BREAK_BRKPT_VAL 514
189 1.1 deraadt #define MACH_BREAK_KDB (MACH_BREAK_INSTR | \
190 1.1 deraadt (MACH_BREAK_KDB_VAL << MACH_BREAK_VAL_SHIFT))
191 1.1 deraadt #define MACH_BREAK_SSTEP (MACH_BREAK_INSTR | \
192 1.1 deraadt (MACH_BREAK_SSTEP_VAL << MACH_BREAK_VAL_SHIFT))
193 1.1 deraadt #define MACH_BREAK_BRKPT (MACH_BREAK_INSTR | \
194 1.1 deraadt (MACH_BREAK_BRKPT_VAL << MACH_BREAK_VAL_SHIFT))
195 1.1 deraadt
196 1.1 deraadt /*
197 1.1 deraadt * Mininum and maximum cache sizes.
198 1.1 deraadt */
199 1.1 deraadt #define MACH_MIN_CACHE_SIZE (16 * 1024)
200 1.1 deraadt #define MACH_MAX_CACHE_SIZE (256 * 1024)
201 1.1 deraadt
202 1.1 deraadt /*
203 1.1 deraadt * The floating point version and status registers.
204 1.1 deraadt */
205 1.1 deraadt #define MACH_FPC_ID $0
206 1.1 deraadt #define MACH_FPC_CSR $31
207 1.1 deraadt
208 1.1 deraadt /*
209 1.1 deraadt * The floating point coprocessor status register bits.
210 1.1 deraadt */
211 1.1 deraadt #define MACH_FPC_ROUNDING_BITS 0x00000003
212 1.1 deraadt #define MACH_FPC_ROUND_RN 0x00000000
213 1.1 deraadt #define MACH_FPC_ROUND_RZ 0x00000001
214 1.1 deraadt #define MACH_FPC_ROUND_RP 0x00000002
215 1.1 deraadt #define MACH_FPC_ROUND_RM 0x00000003
216 1.1 deraadt #define MACH_FPC_STICKY_BITS 0x0000007c
217 1.1 deraadt #define MACH_FPC_STICKY_INEXACT 0x00000004
218 1.1 deraadt #define MACH_FPC_STICKY_UNDERFLOW 0x00000008
219 1.1 deraadt #define MACH_FPC_STICKY_OVERFLOW 0x00000010
220 1.1 deraadt #define MACH_FPC_STICKY_DIV0 0x00000020
221 1.1 deraadt #define MACH_FPC_STICKY_INVALID 0x00000040
222 1.1 deraadt #define MACH_FPC_ENABLE_BITS 0x00000f80
223 1.1 deraadt #define MACH_FPC_ENABLE_INEXACT 0x00000080
224 1.1 deraadt #define MACH_FPC_ENABLE_UNDERFLOW 0x00000100
225 1.1 deraadt #define MACH_FPC_ENABLE_OVERFLOW 0x00000200
226 1.1 deraadt #define MACH_FPC_ENABLE_DIV0 0x00000400
227 1.1 deraadt #define MACH_FPC_ENABLE_INVALID 0x00000800
228 1.1 deraadt #define MACH_FPC_EXCEPTION_BITS 0x0003f000
229 1.1 deraadt #define MACH_FPC_EXCEPTION_INEXACT 0x00001000
230 1.1 deraadt #define MACH_FPC_EXCEPTION_UNDERFLOW 0x00002000
231 1.1 deraadt #define MACH_FPC_EXCEPTION_OVERFLOW 0x00004000
232 1.1 deraadt #define MACH_FPC_EXCEPTION_DIV0 0x00008000
233 1.1 deraadt #define MACH_FPC_EXCEPTION_INVALID 0x00010000
234 1.1 deraadt #define MACH_FPC_EXCEPTION_UNIMPL 0x00020000
235 1.1 deraadt #define MACH_FPC_COND_BIT 0x00800000
236 1.1 deraadt #define MACH_FPC_MBZ_BITS 0xff7c0000
237 1.1 deraadt
238 1.1 deraadt /*
239 1.1 deraadt * Constants to determine if have a floating point instruction.
240 1.1 deraadt */
241 1.1 deraadt #define MACH_OPCODE_SHIFT 26
242 1.1 deraadt #define MACH_OPCODE_C1 0x11
243 1.1 deraadt
244 1.1 deraadt /*
245 1.1 deraadt * The low part of the TLB entry.
246 1.1 deraadt */
247 1.1 deraadt #define VMMACH_TLB_PF_NUM 0xfffff000
248 1.1 deraadt #define VMMACH_TLB_NON_CACHEABLE_BIT 0x00000800
249 1.1 deraadt #define VMMACH_TLB_MOD_BIT 0x00000400
250 1.1 deraadt #define VMMACH_TLB_VALID_BIT 0x00000200
251 1.1 deraadt #define VMMACH_TLB_GLOBAL_BIT 0x00000100
252 1.1 deraadt
253 1.1 deraadt #define VMMACH_TLB_PHYS_PAGE_SHIFT 12
254 1.1 deraadt
255 1.1 deraadt /*
256 1.1 deraadt * The high part of the TLB entry.
257 1.1 deraadt */
258 1.1 deraadt #define VMMACH_TLB_VIRT_PAGE_NUM 0xfffff000
259 1.1 deraadt #define VMMACH_TLB_PID 0x00000fc0
260 1.1 deraadt #define VMMACH_TLB_PID_SHIFT 6
261 1.1 deraadt #define VMMACH_TLB_VIRT_PAGE_SHIFT 12
262 1.1 deraadt
263 1.1 deraadt /*
264 1.1 deraadt * The shift to put the index in the right spot.
265 1.1 deraadt */
266 1.1 deraadt #define VMMACH_TLB_INDEX_SHIFT 8
267 1.1 deraadt
268 1.1 deraadt /*
269 1.1 deraadt * The number of TLB entries and the first one that write random hits.
270 1.1 deraadt */
271 1.1 deraadt #define VMMACH_NUM_TLB_ENTRIES 64
272 1.1 deraadt #define VMMACH_FIRST_RAND_ENTRY 8
273 1.1 deraadt
274 1.1 deraadt /*
275 1.1 deraadt * The number of process id entries.
276 1.1 deraadt */
277 1.1 deraadt #define VMMACH_NUM_PIDS 64
278 1.1 deraadt
279 1.1 deraadt /*
280 1.1 deraadt * TLB probe return codes.
281 1.1 deraadt */
282 1.1 deraadt #define VMMACH_TLB_NOT_FOUND 0
283 1.1 deraadt #define VMMACH_TLB_FOUND 1
284 1.1 deraadt #define VMMACH_TLB_FOUND_WITH_PATCH 2
285 1.1 deraadt #define VMMACH_TLB_PROBE_ERROR 3
286 1.1 deraadt
287 1.1 deraadt /*
288 1.1 deraadt * Kernel virtual address for user page table entries
289 1.1 deraadt * (i.e., the address for the context register).
290 1.1 deraadt */
291 1.1 deraadt #define VMMACH_PTE_BASE 0xFFC00000
292 1.1 deraadt
293 1.1 deraadt #endif /* _MACHCONST */
294