root / target-ppc / op_helper_mem.h @ 7c417963
History | View | Annotate | Download (10.9 kB)
1 | 76a66253 | j_mayer | /*
|
---|---|---|---|
2 | 76a66253 | j_mayer | * PowerPC emulation micro-operations helpers for qemu.
|
3 | d9bce9d9 | j_mayer | *
|
4 | 76a66253 | j_mayer | * Copyright (c) 2003-2007 Jocelyn Mayer
|
5 | 76a66253 | j_mayer | *
|
6 | 76a66253 | j_mayer | * This library is free software; you can redistribute it and/or
|
7 | 76a66253 | j_mayer | * modify it under the terms of the GNU Lesser General Public
|
8 | 76a66253 | j_mayer | * License as published by the Free Software Foundation; either
|
9 | 76a66253 | j_mayer | * version 2 of the License, or (at your option) any later version.
|
10 | 76a66253 | j_mayer | *
|
11 | 76a66253 | j_mayer | * This library is distributed in the hope that it will be useful,
|
12 | 76a66253 | j_mayer | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 76a66253 | j_mayer | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | 76a66253 | j_mayer | * Lesser General Public License for more details.
|
15 | 76a66253 | j_mayer | *
|
16 | 76a66253 | j_mayer | * You should have received a copy of the GNU Lesser General Public
|
17 | 76a66253 | j_mayer | * License along with this library; if not, write to the Free Software
|
18 | 76a66253 | j_mayer | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19 | 76a66253 | j_mayer | */
|
20 | 76a66253 | j_mayer | |
21 | e7c24003 | j_mayer | #include "op_mem_access.h" |
22 | 76a66253 | j_mayer | |
23 | e7c24003 | j_mayer | /* Multiple word / string load and store */
|
24 | 76a66253 | j_mayer | void glue(do_lmw, MEMSUFFIX) (int dst) |
25 | 76a66253 | j_mayer | { |
26 | 76a66253 | j_mayer | for (; dst < 32; dst++, T0 += 4) { |
27 | e7c24003 | j_mayer | env->gpr[dst] = glue(ldu32, MEMSUFFIX)((uint32_t)T0); |
28 | d9bce9d9 | j_mayer | } |
29 | d9bce9d9 | j_mayer | } |
30 | d9bce9d9 | j_mayer | |
31 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
32 | d9bce9d9 | j_mayer | void glue(do_lmw_64, MEMSUFFIX) (int dst) |
33 | d9bce9d9 | j_mayer | { |
34 | d9bce9d9 | j_mayer | for (; dst < 32; dst++, T0 += 4) { |
35 | e7c24003 | j_mayer | env->gpr[dst] = glue(ldu32, MEMSUFFIX)((uint64_t)T0); |
36 | 76a66253 | j_mayer | } |
37 | 76a66253 | j_mayer | } |
38 | d9bce9d9 | j_mayer | #endif
|
39 | 76a66253 | j_mayer | |
40 | 76a66253 | j_mayer | void glue(do_stmw, MEMSUFFIX) (int src) |
41 | 76a66253 | j_mayer | { |
42 | 76a66253 | j_mayer | for (; src < 32; src++, T0 += 4) { |
43 | e7c24003 | j_mayer | glue(st32, MEMSUFFIX)((uint32_t)T0, env->gpr[src]); |
44 | d9bce9d9 | j_mayer | } |
45 | d9bce9d9 | j_mayer | } |
46 | d9bce9d9 | j_mayer | |
47 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
48 | d9bce9d9 | j_mayer | void glue(do_stmw_64, MEMSUFFIX) (int src) |
49 | d9bce9d9 | j_mayer | { |
50 | d9bce9d9 | j_mayer | for (; src < 32; src++, T0 += 4) { |
51 | e7c24003 | j_mayer | glue(st32, MEMSUFFIX)((uint64_t)T0, env->gpr[src]); |
52 | 76a66253 | j_mayer | } |
53 | 76a66253 | j_mayer | } |
54 | d9bce9d9 | j_mayer | #endif
|
55 | 76a66253 | j_mayer | |
56 | 76a66253 | j_mayer | void glue(do_lmw_le, MEMSUFFIX) (int dst) |
57 | 76a66253 | j_mayer | { |
58 | 76a66253 | j_mayer | for (; dst < 32; dst++, T0 += 4) { |
59 | e7c24003 | j_mayer | env->gpr[dst] = glue(ldu32r, MEMSUFFIX)((uint32_t)T0); |
60 | d9bce9d9 | j_mayer | } |
61 | d9bce9d9 | j_mayer | } |
62 | d9bce9d9 | j_mayer | |
63 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
64 | d9bce9d9 | j_mayer | void glue(do_lmw_le_64, MEMSUFFIX) (int dst) |
65 | d9bce9d9 | j_mayer | { |
66 | d9bce9d9 | j_mayer | for (; dst < 32; dst++, T0 += 4) { |
67 | e7c24003 | j_mayer | env->gpr[dst] = glue(ldu32r, MEMSUFFIX)((uint64_t)T0); |
68 | 76a66253 | j_mayer | } |
69 | 76a66253 | j_mayer | } |
70 | d9bce9d9 | j_mayer | #endif
|
71 | 76a66253 | j_mayer | |
72 | 76a66253 | j_mayer | void glue(do_stmw_le, MEMSUFFIX) (int src) |
73 | 76a66253 | j_mayer | { |
74 | 76a66253 | j_mayer | for (; src < 32; src++, T0 += 4) { |
75 | 8b67546f | j_mayer | glue(st32r, MEMSUFFIX)((uint32_t)T0, env->gpr[src]); |
76 | 76a66253 | j_mayer | } |
77 | 76a66253 | j_mayer | } |
78 | 76a66253 | j_mayer | |
79 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
80 | d9bce9d9 | j_mayer | void glue(do_stmw_le_64, MEMSUFFIX) (int src) |
81 | d9bce9d9 | j_mayer | { |
82 | d9bce9d9 | j_mayer | for (; src < 32; src++, T0 += 4) { |
83 | 8b67546f | j_mayer | glue(st32r, MEMSUFFIX)((uint64_t)T0, env->gpr[src]); |
84 | d9bce9d9 | j_mayer | } |
85 | d9bce9d9 | j_mayer | } |
86 | d9bce9d9 | j_mayer | #endif
|
87 | d9bce9d9 | j_mayer | |
88 | 9a64fbe4 | bellard | void glue(do_lsw, MEMSUFFIX) (int dst) |
89 | 9a64fbe4 | bellard | { |
90 | 9a64fbe4 | bellard | uint32_t tmp; |
91 | 9a64fbe4 | bellard | int sh;
|
92 | 9a64fbe4 | bellard | |
93 | 9a64fbe4 | bellard | for (; T1 > 3; T1 -= 4, T0 += 4) { |
94 | e7c24003 | j_mayer | env->gpr[dst++] = glue(ldu32, MEMSUFFIX)((uint32_t)T0); |
95 | 76a66253 | j_mayer | if (unlikely(dst == 32)) |
96 | 9a64fbe4 | bellard | dst = 0;
|
97 | 9a64fbe4 | bellard | } |
98 | 76a66253 | j_mayer | if (unlikely(T1 != 0)) { |
99 | 9a64fbe4 | bellard | tmp = 0;
|
100 | 9a64fbe4 | bellard | for (sh = 24; T1 > 0; T1--, T0++, sh -= 8) { |
101 | e7c24003 | j_mayer | tmp |= glue(ldu8, MEMSUFFIX)((uint32_t)T0) << sh; |
102 | 9a64fbe4 | bellard | } |
103 | 8b67546f | j_mayer | env->gpr[dst] = tmp; |
104 | 9a64fbe4 | bellard | } |
105 | 9a64fbe4 | bellard | } |
106 | 9a64fbe4 | bellard | |
107 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
108 | d9bce9d9 | j_mayer | void glue(do_lsw_64, MEMSUFFIX) (int dst) |
109 | d9bce9d9 | j_mayer | { |
110 | d9bce9d9 | j_mayer | uint32_t tmp; |
111 | d9bce9d9 | j_mayer | int sh;
|
112 | d9bce9d9 | j_mayer | |
113 | d9bce9d9 | j_mayer | for (; T1 > 3; T1 -= 4, T0 += 4) { |
114 | e7c24003 | j_mayer | env->gpr[dst++] = glue(ldu32, MEMSUFFIX)((uint64_t)T0); |
115 | d9bce9d9 | j_mayer | if (unlikely(dst == 32)) |
116 | d9bce9d9 | j_mayer | dst = 0;
|
117 | d9bce9d9 | j_mayer | } |
118 | d9bce9d9 | j_mayer | if (unlikely(T1 != 0)) { |
119 | d9bce9d9 | j_mayer | tmp = 0;
|
120 | d9bce9d9 | j_mayer | for (sh = 24; T1 > 0; T1--, T0++, sh -= 8) { |
121 | e7c24003 | j_mayer | tmp |= glue(ldu8, MEMSUFFIX)((uint64_t)T0) << sh; |
122 | d9bce9d9 | j_mayer | } |
123 | 8b67546f | j_mayer | env->gpr[dst] = tmp; |
124 | d9bce9d9 | j_mayer | } |
125 | d9bce9d9 | j_mayer | } |
126 | d9bce9d9 | j_mayer | #endif
|
127 | d9bce9d9 | j_mayer | |
128 | 9a64fbe4 | bellard | void glue(do_stsw, MEMSUFFIX) (int src) |
129 | 9a64fbe4 | bellard | { |
130 | 9a64fbe4 | bellard | int sh;
|
131 | 9a64fbe4 | bellard | |
132 | 9a64fbe4 | bellard | for (; T1 > 3; T1 -= 4, T0 += 4) { |
133 | e7c24003 | j_mayer | glue(st32, MEMSUFFIX)((uint32_t)T0, env->gpr[src++]); |
134 | 76a66253 | j_mayer | if (unlikely(src == 32)) |
135 | 9a64fbe4 | bellard | src = 0;
|
136 | 9a64fbe4 | bellard | } |
137 | 76a66253 | j_mayer | if (unlikely(T1 != 0)) { |
138 | 9a64fbe4 | bellard | for (sh = 24; T1 > 0; T1--, T0++, sh -= 8) |
139 | e7c24003 | j_mayer | glue(st8, MEMSUFFIX)((uint32_t)T0, (env->gpr[src] >> sh) & 0xFF);
|
140 | 9a64fbe4 | bellard | } |
141 | 9a64fbe4 | bellard | } |
142 | 9a64fbe4 | bellard | |
143 | d9bce9d9 | j_mayer | #if defined(TARGET_PPC64)
|
144 | d9bce9d9 | j_mayer | void glue(do_stsw_64, MEMSUFFIX) (int src) |
145 | d9bce9d9 | j_mayer | { |
146 | d9bce9d9 | j_mayer | int sh;
|
147 | d9bce9d9 | j_mayer | |
148 | d9bce9d9 | j_mayer | for (; T1 > 3; T1 -= 4, T0 += 4) { |
149 | e7c24003 | j_mayer | glue(st32, MEMSUFFIX)((uint64_t)T0, env->gpr[src++]); |
150 | d9bce9d9 | j_mayer | if (unlikely(src == 32)) |
151 | d9bce9d9 | j_mayer | src = 0;
|
152 | d9bce9d9 | j_mayer | } |
153 | d9bce9d9 | j_mayer | if (unlikely(T1 != 0)) { |
154 | d9bce9d9 | j_mayer | for (sh = 24; T1 > 0; T1--, T0++, sh -= 8) |
155 | e7c24003 | j_mayer | glue(st8, MEMSUFFIX)((uint64_t)T0, (env->gpr[src] >> sh) & 0xFF);
|
156 | 111bfab3 | bellard | } |
157 | 111bfab3 | bellard | } |
158 | d9bce9d9 | j_mayer | #endif
|
159 | 111bfab3 | bellard | |
160 | 36f69651 | j_mayer | /* Instruction cache invalidation helper */
|
161 | 36f69651 | j_mayer | void glue(do_icbi, MEMSUFFIX) (void) |
162 | 36f69651 | j_mayer | { |
163 | 36f69651 | j_mayer | uint32_t tmp; |
164 | 36f69651 | j_mayer | /* Invalidate one cache line :
|
165 | 36f69651 | j_mayer | * PowerPC specification says this is to be treated like a load
|
166 | 36f69651 | j_mayer | * (not a fetch) by the MMU. To be sure it will be so,
|
167 | 36f69651 | j_mayer | * do the load "by hand".
|
168 | 36f69651 | j_mayer | */
|
169 | d63001d1 | j_mayer | T0 &= ~(env->icache_line_size - 1);
|
170 | f0685f6e | j_mayer | tmp = glue(ldl, MEMSUFFIX)((uint32_t)T0); |
171 | d63001d1 | j_mayer | tb_invalidate_page_range((uint32_t)T0, |
172 | d63001d1 | j_mayer | (uint32_t)(T0 + env->icache_line_size)); |
173 | 36f69651 | j_mayer | } |
174 | 36f69651 | j_mayer | |
175 | 36f69651 | j_mayer | #if defined(TARGET_PPC64)
|
176 | 36f69651 | j_mayer | void glue(do_icbi_64, MEMSUFFIX) (void) |
177 | 36f69651 | j_mayer | { |
178 | 36f69651 | j_mayer | uint64_t tmp; |
179 | 36f69651 | j_mayer | /* Invalidate one cache line :
|
180 | 36f69651 | j_mayer | * PowerPC specification says this is to be treated like a load
|
181 | 36f69651 | j_mayer | * (not a fetch) by the MMU. To be sure it will be so,
|
182 | 36f69651 | j_mayer | * do the load "by hand".
|
183 | 36f69651 | j_mayer | */
|
184 | d63001d1 | j_mayer | T0 &= ~(env->icache_line_size - 1);
|
185 | f0685f6e | j_mayer | tmp = glue(ldq, MEMSUFFIX)((uint64_t)T0); |
186 | d63001d1 | j_mayer | tb_invalidate_page_range((uint64_t)T0, |
187 | d63001d1 | j_mayer | (uint64_t)(T0 + env->icache_line_size)); |
188 | d63001d1 | j_mayer | } |
189 | d63001d1 | j_mayer | #endif
|
190 | d63001d1 | j_mayer | |
191 | d63001d1 | j_mayer | void glue(do_dcbz, MEMSUFFIX) (void) |
192 | d63001d1 | j_mayer | { |
193 | d63001d1 | j_mayer | int dcache_line_size = env->dcache_line_size;
|
194 | d63001d1 | j_mayer | |
195 | d63001d1 | j_mayer | /* XXX: should be 970 specific (?) */
|
196 | d63001d1 | j_mayer | if (((env->spr[SPR_970_HID5] >> 7) & 0x3) == 1) |
197 | d63001d1 | j_mayer | dcache_line_size = 32;
|
198 | e7c24003 | j_mayer | T0 &= ~(uint32_t)(dcache_line_size - 1);
|
199 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x00), 0); |
200 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x04), 0); |
201 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x08), 0); |
202 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x0C), 0); |
203 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x10), 0); |
204 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x14), 0); |
205 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x18), 0); |
206 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x1C), 0); |
207 | d63001d1 | j_mayer | if (dcache_line_size >= 64) { |
208 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x20UL), 0); |
209 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x24UL), 0); |
210 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x28UL), 0); |
211 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x2CUL), 0); |
212 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x30UL), 0); |
213 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x34UL), 0); |
214 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x38UL), 0); |
215 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x3CUL), 0); |
216 | d63001d1 | j_mayer | if (dcache_line_size >= 128) { |
217 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x40UL), 0); |
218 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x44UL), 0); |
219 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x48UL), 0); |
220 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x4CUL), 0); |
221 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x50UL), 0); |
222 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x54UL), 0); |
223 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x58UL), 0); |
224 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x5CUL), 0); |
225 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x60UL), 0); |
226 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x64UL), 0); |
227 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x68UL), 0); |
228 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x6CUL), 0); |
229 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x70UL), 0); |
230 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x74UL), 0); |
231 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x78UL), 0); |
232 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint32_t)(T0 + 0x7CUL), 0); |
233 | d63001d1 | j_mayer | } |
234 | d63001d1 | j_mayer | } |
235 | d63001d1 | j_mayer | } |
236 | d63001d1 | j_mayer | |
237 | d63001d1 | j_mayer | #if defined(TARGET_PPC64)
|
238 | d63001d1 | j_mayer | void glue(do_dcbz_64, MEMSUFFIX) (void) |
239 | d63001d1 | j_mayer | { |
240 | d63001d1 | j_mayer | int dcache_line_size = env->dcache_line_size;
|
241 | d63001d1 | j_mayer | |
242 | d63001d1 | j_mayer | /* XXX: should be 970 specific (?) */
|
243 | e57448f1 | j_mayer | if (((env->spr[SPR_970_HID5] >> 6) & 0x3) == 0x2) |
244 | d63001d1 | j_mayer | dcache_line_size = 32;
|
245 | e7c24003 | j_mayer | T0 &= ~(uint64_t)(dcache_line_size - 1);
|
246 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x00), 0); |
247 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x04), 0); |
248 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x08), 0); |
249 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x0C), 0); |
250 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x10), 0); |
251 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x14), 0); |
252 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x18), 0); |
253 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x1C), 0); |
254 | d63001d1 | j_mayer | if (dcache_line_size >= 64) { |
255 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x20UL), 0); |
256 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x24UL), 0); |
257 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x28UL), 0); |
258 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x2CUL), 0); |
259 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x30UL), 0); |
260 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x34UL), 0); |
261 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x38UL), 0); |
262 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x3CUL), 0); |
263 | d63001d1 | j_mayer | if (dcache_line_size >= 128) { |
264 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x40UL), 0); |
265 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x44UL), 0); |
266 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x48UL), 0); |
267 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x4CUL), 0); |
268 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x50UL), 0); |
269 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x54UL), 0); |
270 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x58UL), 0); |
271 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x5CUL), 0); |
272 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x60UL), 0); |
273 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x64UL), 0); |
274 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x68UL), 0); |
275 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x6CUL), 0); |
276 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x70UL), 0); |
277 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x74UL), 0); |
278 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x78UL), 0); |
279 | d63001d1 | j_mayer | glue(stl, MEMSUFFIX)((uint64_t)(T0 + 0x7CUL), 0); |
280 | d63001d1 | j_mayer | } |
281 | d63001d1 | j_mayer | } |
282 | 36f69651 | j_mayer | } |
283 | 36f69651 | j_mayer | #endif
|
284 | 36f69651 | j_mayer | |
285 | 36081602 | j_mayer | /* PowerPC 601 specific instructions (POWER bridge) */
|
286 | 76a66253 | j_mayer | // XXX: to be tested
|
287 | 76a66253 | j_mayer | void glue(do_POWER_lscbx, MEMSUFFIX) (int dest, int ra, int rb) |
288 | 76a66253 | j_mayer | { |
289 | 76a66253 | j_mayer | int i, c, d, reg;
|
290 | 76a66253 | j_mayer | |
291 | 76a66253 | j_mayer | d = 24;
|
292 | 76a66253 | j_mayer | reg = dest; |
293 | 76a66253 | j_mayer | for (i = 0; i < T1; i++) { |
294 | e7c24003 | j_mayer | c = glue(ldu8, MEMSUFFIX)((uint32_t)T0++); |
295 | 76a66253 | j_mayer | /* ra (if not 0) and rb are never modified */
|
296 | 76a66253 | j_mayer | if (likely(reg != rb && (ra == 0 || reg != ra))) { |
297 | 8b67546f | j_mayer | env->gpr[reg] = (env->gpr[reg] & ~(0xFF << d)) | (c << d);
|
298 | 76a66253 | j_mayer | } |
299 | 76a66253 | j_mayer | if (unlikely(c == T2))
|
300 | 76a66253 | j_mayer | break;
|
301 | 76a66253 | j_mayer | if (likely(d != 0)) { |
302 | 76a66253 | j_mayer | d -= 8;
|
303 | 76a66253 | j_mayer | } else {
|
304 | 76a66253 | j_mayer | d = 24;
|
305 | 76a66253 | j_mayer | reg++; |
306 | 76a66253 | j_mayer | reg = reg & 0x1F;
|
307 | 76a66253 | j_mayer | } |
308 | 76a66253 | j_mayer | } |
309 | 76a66253 | j_mayer | T0 = i; |
310 | 76a66253 | j_mayer | } |
311 | 76a66253 | j_mayer | |
312 | 76a66253 | j_mayer | /* XXX: TAGs are not managed */
|
313 | 76a66253 | j_mayer | void glue(do_POWER2_lfq, MEMSUFFIX) (void) |
314 | 76a66253 | j_mayer | { |
315 | d9bce9d9 | j_mayer | FT0 = glue(ldfq, MEMSUFFIX)((uint32_t)T0); |
316 | d9bce9d9 | j_mayer | FT1 = glue(ldfq, MEMSUFFIX)((uint32_t)(T0 + 4));
|
317 | 76a66253 | j_mayer | } |
318 | 76a66253 | j_mayer | |
319 | 0ca9d380 | aurel32 | static always_inline float64 glue(ldfqr, MEMSUFFIX) (target_ulong EA)
|
320 | 76a66253 | j_mayer | { |
321 | 0ca9d380 | aurel32 | CPU_DoubleU u; |
322 | 76a66253 | j_mayer | |
323 | 76a66253 | j_mayer | u.d = glue(ldfq, MEMSUFFIX)(EA); |
324 | 0ca9d380 | aurel32 | u.ll = bswap64(u.ll); |
325 | 76a66253 | j_mayer | |
326 | 76a66253 | j_mayer | return u.d;
|
327 | 76a66253 | j_mayer | } |
328 | 76a66253 | j_mayer | |
329 | 76a66253 | j_mayer | void glue(do_POWER2_lfq_le, MEMSUFFIX) (void) |
330 | 76a66253 | j_mayer | { |
331 | d9bce9d9 | j_mayer | FT0 = glue(ldfqr, MEMSUFFIX)((uint32_t)(T0 + 4));
|
332 | d9bce9d9 | j_mayer | FT1 = glue(ldfqr, MEMSUFFIX)((uint32_t)T0); |
333 | 76a66253 | j_mayer | } |
334 | 76a66253 | j_mayer | |
335 | 76a66253 | j_mayer | void glue(do_POWER2_stfq, MEMSUFFIX) (void) |
336 | 76a66253 | j_mayer | { |
337 | d9bce9d9 | j_mayer | glue(stfq, MEMSUFFIX)((uint32_t)T0, FT0); |
338 | d9bce9d9 | j_mayer | glue(stfq, MEMSUFFIX)((uint32_t)(T0 + 4), FT1);
|
339 | 76a66253 | j_mayer | } |
340 | 76a66253 | j_mayer | |
341 | 0ca9d380 | aurel32 | static always_inline void glue(stfqr, MEMSUFFIX) (target_ulong EA, float64 d) |
342 | 76a66253 | j_mayer | { |
343 | 0ca9d380 | aurel32 | CPU_DoubleU u; |
344 | 76a66253 | j_mayer | |
345 | 76a66253 | j_mayer | u.d = d; |
346 | 0ca9d380 | aurel32 | u.ll = bswap64(u.ll); |
347 | 76a66253 | j_mayer | glue(stfq, MEMSUFFIX)(EA, u.d); |
348 | 76a66253 | j_mayer | } |
349 | 76a66253 | j_mayer | |
350 | 76a66253 | j_mayer | void glue(do_POWER2_stfq_le, MEMSUFFIX) (void) |
351 | 76a66253 | j_mayer | { |
352 | d9bce9d9 | j_mayer | glue(stfqr, MEMSUFFIX)((uint32_t)(T0 + 4), FT0);
|
353 | d9bce9d9 | j_mayer | glue(stfqr, MEMSUFFIX)((uint32_t)T0, FT1); |
354 | 76a66253 | j_mayer | } |
355 | 76a66253 | j_mayer | |
356 | 9a64fbe4 | bellard | #undef MEMSUFFIX |