xref: /openbsd/sys/arch/m88k/m88k/m88110_mmu.S (revision 09467b48)
1#	$OpenBSD: m88110_mmu.S,v 1.7 2013/01/05 11:20:56 miod Exp $
2/*
3 * Copyright (c) 2000 Steve Murphree, Jr.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 *    must display the following acknowledgement:
16 *      This product includes software developed by Steve Murphree, Jr.
17 * 4. The name of the author may not be used to endorse or promote products
18 *    derived from this software without specific prior written permission
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33#include <machine/asm.h>
34
35/*
36 * 88110 errata #20 (4.2) or #4 (5.1.1):
37 * ``If a ldcr, stcr, fldcr, or fstcr instruction is located in the last
38 *   word of an instruction page, and the fetch of the next page results
39 *   in an mmu exception (invalid descriptor, tablewalk bus error,
40 *   software atc miss), the exip and enip value may be incorrectly
41 *   incremented to the second word of the page.
42 *   Suggested fix: do not allow these instructions to occupy the last
43 *   word of a page if this can occur.''
44 *
45 * This is why the following function are not inlines in asm.h, and are
46 * aligned to 32 byte boundaries.
47 *
48 * Note that fldcr/fstcr are used in several places in userland (libc,
49 * libpthread, afs lwp) which will need alignment hints as well to
50 * avoid this. Sigh -- miod
51 */
52
53	.text
54
55/* set routines */
56	.align 5
57ENTRY(set_icmd)
58	FLUSH_PIPELINE
59	stcr	%r2, ICMD
60	jmp	%r1
61
62	.align 5
63ENTRY(set_ictl)
64	FLUSH_PIPELINE
65	stcr	%r2, ICTL
66	NOP
67	FLUSH_PIPELINE
68	jmp	%r1
69
70	.align 5
71ENTRY(set_isar)
72	stcr	%r2, ISAR
73	jmp	%r1
74
75	.align 5
76ENTRY(set_isap)
77	FLUSH_PIPELINE
78	NOP
79	stcr	%r2, ISAP
80	jmp	%r1
81
82	.align 5
83ENTRY(set_iuap)
84	FLUSH_PIPELINE
85	NOP
86 	stcr	%r2, IUAP
87	jmp	%r1
88
89	.align 5
90ENTRY(set_iir)
91	stcr	%r2, IIR
92	jmp	%r1
93
94	.align 5
95ENTRY(set_ibp)
96	stcr	%r2, IBP
97	jmp	%r1
98
99	.align 5
100ENTRY(set_ippu)
101	stcr	%r2, IPPU
102	jmp	%r1
103
104	.align 5
105ENTRY(set_ippl)
106	stcr	%r2, IPPL
107	jmp	%r1
108
109	.align 5
110ENTRY(set_isr)
111	stcr	%r2, ISR
112	jmp	%r1
113
114	.align 5
115ENTRY(set_dcmd)
116	FLUSH_PIPELINE
117	stcr	%r2, DCMD
118	jmp	%r1
119
120	.align 5
121ENTRY(set_dctl)
122	FLUSH_PIPELINE
123	stcr	%r2, DCTL
124	NOP
125	FLUSH_PIPELINE
126	jmp	%r1
127
128	.align 5
129ENTRY(set_dsar)
130	stcr	%r2, DSAR
131	NOP
132	jmp	%r1
133
134	.align 5
135ENTRY(set_dsap)
136	FLUSH_PIPELINE
137	NOP
138	stcr	%r2, DSAP
139	FLUSH_PIPELINE
140	NOP
141	jmp	%r1
142
143	.align 5
144ENTRY(set_duap)
145	FLUSH_PIPELINE
146	NOP
147	stcr	%r2, DUAP
148	FLUSH_PIPELINE
149	NOP
150	jmp	%r1
151
152	.align 5
153ENTRY(set_dir)
154	stcr	%r2, DIR
155	jmp	%r1
156
157	.align 5
158ENTRY(set_dbp)
159	stcr	%r2, DBP
160	jmp	%r1
161
162	.align 5
163ENTRY(set_dppu)
164	stcr	%r2, DPPU
165	jmp	%r1
166
167	.align 5
168ENTRY(set_dppl)
169	stcr	%r2, DPPL
170	jmp	%r1
171
172	.align 5
173ENTRY(set_dsr)
174	stcr	%r2, DSR
175	jmp	%r1
176
177/* get routines */
178	.align 5
179ENTRY(get_ictl)
180	ldcr	%r2, ICTL
181	jmp	%r1
182
183	.align 5
184ENTRY(get_dctl)
185	ldcr	%r2, DCTL
186	jmp	%r1
187
188	.align 5
189ENTRY(get_dsr)
190	ldcr	%r2, DSR
191	jmp	%r1
192
193	.align 5
194ENTRY(get_isr)
195	ldcr	%r2, ISR
196	jmp	%r1
197