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