root / softmmu_header.h @ 42fc925e
History | View | Annotate | Download (10.7 kB)
1 | b92e5a22 | bellard | /*
|
---|---|---|---|
2 | b92e5a22 | bellard | * Software MMU support
|
3 | b92e5a22 | bellard | *
|
4 | b92e5a22 | bellard | * Copyright (c) 2003 Fabrice Bellard
|
5 | b92e5a22 | bellard | *
|
6 | b92e5a22 | bellard | * This library is free software; you can redistribute it and/or
|
7 | b92e5a22 | bellard | * modify it under the terms of the GNU Lesser General Public
|
8 | b92e5a22 | bellard | * License as published by the Free Software Foundation; either
|
9 | b92e5a22 | bellard | * version 2 of the License, or (at your option) any later version.
|
10 | b92e5a22 | bellard | *
|
11 | b92e5a22 | bellard | * This library is distributed in the hope that it will be useful,
|
12 | b92e5a22 | bellard | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | b92e5a22 | bellard | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 | b92e5a22 | bellard | * Lesser General Public License for more details.
|
15 | b92e5a22 | bellard | *
|
16 | b92e5a22 | bellard | * You should have received a copy of the GNU Lesser General Public
|
17 | b92e5a22 | bellard | * License along with this library; if not, write to the Free Software
|
18 | b92e5a22 | bellard | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19 | b92e5a22 | bellard | */
|
20 | b92e5a22 | bellard | #if DATA_SIZE == 8 |
21 | b92e5a22 | bellard | #define SUFFIX q
|
22 | 61382a50 | bellard | #define USUFFIX q
|
23 | b92e5a22 | bellard | #define DATA_TYPE uint64_t
|
24 | b92e5a22 | bellard | #elif DATA_SIZE == 4 |
25 | b92e5a22 | bellard | #define SUFFIX l
|
26 | 61382a50 | bellard | #define USUFFIX l
|
27 | b92e5a22 | bellard | #define DATA_TYPE uint32_t
|
28 | b92e5a22 | bellard | #elif DATA_SIZE == 2 |
29 | b92e5a22 | bellard | #define SUFFIX w
|
30 | 61382a50 | bellard | #define USUFFIX uw
|
31 | b92e5a22 | bellard | #define DATA_TYPE uint16_t
|
32 | b92e5a22 | bellard | #define DATA_STYPE int16_t
|
33 | b92e5a22 | bellard | #elif DATA_SIZE == 1 |
34 | b92e5a22 | bellard | #define SUFFIX b
|
35 | 61382a50 | bellard | #define USUFFIX ub
|
36 | b92e5a22 | bellard | #define DATA_TYPE uint8_t
|
37 | b92e5a22 | bellard | #define DATA_STYPE int8_t
|
38 | b92e5a22 | bellard | #else
|
39 | b92e5a22 | bellard | #error unsupported data size
|
40 | b92e5a22 | bellard | #endif
|
41 | b92e5a22 | bellard | |
42 | 61382a50 | bellard | #if ACCESS_TYPE == 0 |
43 | 61382a50 | bellard | |
44 | 61382a50 | bellard | #define CPU_MEM_INDEX 0 |
45 | 61382a50 | bellard | #define MMUSUFFIX _mmu
|
46 | 61382a50 | bellard | |
47 | 61382a50 | bellard | #elif ACCESS_TYPE == 1 |
48 | 61382a50 | bellard | |
49 | 61382a50 | bellard | #define CPU_MEM_INDEX 1 |
50 | 61382a50 | bellard | #define MMUSUFFIX _mmu
|
51 | 61382a50 | bellard | |
52 | 61382a50 | bellard | #elif ACCESS_TYPE == 2 |
53 | 61382a50 | bellard | |
54 | 2d603d22 | bellard | #ifdef TARGET_I386
|
55 | 61382a50 | bellard | #define CPU_MEM_INDEX ((env->hflags & HF_CPL_MASK) == 3) |
56 | 2d603d22 | bellard | #elif defined (TARGET_PPC)
|
57 | 2d603d22 | bellard | #define CPU_MEM_INDEX (msr_pr)
|
58 | 6af0bf9c | bellard | #elif defined (TARGET_MIPS)
|
59 | 6af0bf9c | bellard | #define CPU_MEM_INDEX ((env->hflags & MIPS_HFLAG_MODE) == MIPS_HFLAG_UM)
|
60 | e95c8d51 | bellard | #elif defined (TARGET_SPARC)
|
61 | e95c8d51 | bellard | #define CPU_MEM_INDEX ((env->psrs) == 0) |
62 | b5ff1b31 | bellard | #elif defined (TARGET_ARM)
|
63 | b5ff1b31 | bellard | #define CPU_MEM_INDEX ((env->uncached_cpsr & CPSR_M) == ARM_CPU_MODE_USR)
|
64 | fdf9b3e8 | bellard | #elif defined (TARGET_SH4)
|
65 | fdf9b3e8 | bellard | #define CPU_MEM_INDEX ((env->sr & SR_MD) == 0) |
66 | b5ff1b31 | bellard | #else
|
67 | b5ff1b31 | bellard | #error unsupported CPU
|
68 | 2d603d22 | bellard | #endif
|
69 | 61382a50 | bellard | #define MMUSUFFIX _mmu
|
70 | 61382a50 | bellard | |
71 | 61382a50 | bellard | #elif ACCESS_TYPE == 3 |
72 | 61382a50 | bellard | |
73 | 2d603d22 | bellard | #ifdef TARGET_I386
|
74 | 61382a50 | bellard | #define CPU_MEM_INDEX ((env->hflags & HF_CPL_MASK) == 3) |
75 | 2d603d22 | bellard | #elif defined (TARGET_PPC)
|
76 | 2d603d22 | bellard | #define CPU_MEM_INDEX (msr_pr)
|
77 | 6af0bf9c | bellard | #elif defined (TARGET_MIPS)
|
78 | 6af0bf9c | bellard | #define CPU_MEM_INDEX ((env->hflags & MIPS_HFLAG_MODE) == MIPS_HFLAG_UM)
|
79 | e95c8d51 | bellard | #elif defined (TARGET_SPARC)
|
80 | e95c8d51 | bellard | #define CPU_MEM_INDEX ((env->psrs) == 0) |
81 | b5ff1b31 | bellard | #elif defined (TARGET_ARM)
|
82 | b5ff1b31 | bellard | #define CPU_MEM_INDEX ((env->uncached_cpsr & CPSR_M) == ARM_CPU_MODE_USR)
|
83 | fdf9b3e8 | bellard | #elif defined (TARGET_SH4)
|
84 | fdf9b3e8 | bellard | #define CPU_MEM_INDEX ((env->sr & SR_MD) == 0) |
85 | b5ff1b31 | bellard | #else
|
86 | b5ff1b31 | bellard | #error unsupported CPU
|
87 | 2d603d22 | bellard | #endif
|
88 | 61382a50 | bellard | #define MMUSUFFIX _cmmu
|
89 | 61382a50 | bellard | |
90 | b92e5a22 | bellard | #else
|
91 | 61382a50 | bellard | #error invalid ACCESS_TYPE
|
92 | b92e5a22 | bellard | #endif
|
93 | b92e5a22 | bellard | |
94 | b92e5a22 | bellard | #if DATA_SIZE == 8 |
95 | b92e5a22 | bellard | #define RES_TYPE uint64_t
|
96 | b92e5a22 | bellard | #else
|
97 | b92e5a22 | bellard | #define RES_TYPE int |
98 | b92e5a22 | bellard | #endif
|
99 | b92e5a22 | bellard | |
100 | 84b7b8e7 | bellard | #if ACCESS_TYPE == 3 |
101 | 84b7b8e7 | bellard | #define ADDR_READ addr_code
|
102 | 84b7b8e7 | bellard | #else
|
103 | 84b7b8e7 | bellard | #define ADDR_READ addr_read
|
104 | 84b7b8e7 | bellard | #endif
|
105 | b92e5a22 | bellard | |
106 | c27004ec | bellard | DATA_TYPE REGPARM(1) glue(glue(__ld, SUFFIX), MMUSUFFIX)(target_ulong addr,
|
107 | 61382a50 | bellard | int is_user);
|
108 | c27004ec | bellard | void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr, DATA_TYPE v, int is_user); |
109 | b92e5a22 | bellard | |
110 | c27004ec | bellard | #if (DATA_SIZE <= 4) && (TARGET_LONG_BITS == 32) && defined(__i386__) && \ |
111 | c27004ec | bellard | (ACCESS_TYPE <= 1) && defined(ASM_SOFTMMU)
|
112 | e16c53fa | bellard | |
113 | 84b7b8e7 | bellard | #define CPU_TLB_ENTRY_BITS 4 |
114 | 84b7b8e7 | bellard | |
115 | c27004ec | bellard | static inline RES_TYPE glue(glue(ld, USUFFIX), MEMSUFFIX)(target_ulong ptr) |
116 | e16c53fa | bellard | { |
117 | e16c53fa | bellard | int res;
|
118 | e16c53fa | bellard | |
119 | e16c53fa | bellard | asm volatile ("movl %1, %%edx\n" |
120 | e16c53fa | bellard | "movl %1, %%eax\n"
|
121 | e16c53fa | bellard | "shrl %3, %%edx\n"
|
122 | e16c53fa | bellard | "andl %4, %%eax\n"
|
123 | e16c53fa | bellard | "andl %2, %%edx\n"
|
124 | e16c53fa | bellard | "leal %5(%%edx, %%ebp), %%edx\n"
|
125 | e16c53fa | bellard | "cmpl (%%edx), %%eax\n"
|
126 | e16c53fa | bellard | "movl %1, %%eax\n"
|
127 | e16c53fa | bellard | "je 1f\n"
|
128 | e16c53fa | bellard | "pushl %6\n"
|
129 | e16c53fa | bellard | "call %7\n"
|
130 | e16c53fa | bellard | "popl %%edx\n"
|
131 | e16c53fa | bellard | "movl %%eax, %0\n"
|
132 | e16c53fa | bellard | "jmp 2f\n"
|
133 | e16c53fa | bellard | "1:\n"
|
134 | 84b7b8e7 | bellard | "addl 12(%%edx), %%eax\n"
|
135 | e16c53fa | bellard | #if DATA_SIZE == 1 |
136 | e16c53fa | bellard | "movzbl (%%eax), %0\n"
|
137 | e16c53fa | bellard | #elif DATA_SIZE == 2 |
138 | e16c53fa | bellard | "movzwl (%%eax), %0\n"
|
139 | e16c53fa | bellard | #elif DATA_SIZE == 4 |
140 | e16c53fa | bellard | "movl (%%eax), %0\n"
|
141 | e16c53fa | bellard | #else
|
142 | e16c53fa | bellard | #error unsupported size
|
143 | e16c53fa | bellard | #endif
|
144 | e16c53fa | bellard | "2:\n"
|
145 | e16c53fa | bellard | : "=r" (res)
|
146 | e16c53fa | bellard | : "r" (ptr),
|
147 | 84b7b8e7 | bellard | "i" ((CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS), |
148 | 84b7b8e7 | bellard | "i" (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS),
|
149 | e16c53fa | bellard | "i" (TARGET_PAGE_MASK | (DATA_SIZE - 1)), |
150 | 84b7b8e7 | bellard | "m" (*(uint32_t *)offsetof(CPUState, tlb_table[CPU_MEM_INDEX][0].addr_read)), |
151 | e16c53fa | bellard | "i" (CPU_MEM_INDEX),
|
152 | e16c53fa | bellard | "m" (*(uint8_t *)&glue(glue(__ld, SUFFIX), MMUSUFFIX))
|
153 | e16c53fa | bellard | : "%eax", "%ecx", "%edx", "memory", "cc"); |
154 | e16c53fa | bellard | return res;
|
155 | e16c53fa | bellard | } |
156 | e16c53fa | bellard | |
157 | e16c53fa | bellard | #if DATA_SIZE <= 2 |
158 | c27004ec | bellard | static inline int glue(glue(lds, SUFFIX), MEMSUFFIX)(target_ulong ptr) |
159 | e16c53fa | bellard | { |
160 | e16c53fa | bellard | int res;
|
161 | e16c53fa | bellard | |
162 | e16c53fa | bellard | asm volatile ("movl %1, %%edx\n" |
163 | e16c53fa | bellard | "movl %1, %%eax\n"
|
164 | e16c53fa | bellard | "shrl %3, %%edx\n"
|
165 | e16c53fa | bellard | "andl %4, %%eax\n"
|
166 | e16c53fa | bellard | "andl %2, %%edx\n"
|
167 | e16c53fa | bellard | "leal %5(%%edx, %%ebp), %%edx\n"
|
168 | e16c53fa | bellard | "cmpl (%%edx), %%eax\n"
|
169 | e16c53fa | bellard | "movl %1, %%eax\n"
|
170 | e16c53fa | bellard | "je 1f\n"
|
171 | e16c53fa | bellard | "pushl %6\n"
|
172 | e16c53fa | bellard | "call %7\n"
|
173 | e16c53fa | bellard | "popl %%edx\n"
|
174 | e16c53fa | bellard | #if DATA_SIZE == 1 |
175 | e16c53fa | bellard | "movsbl %%al, %0\n"
|
176 | e16c53fa | bellard | #elif DATA_SIZE == 2 |
177 | e16c53fa | bellard | "movswl %%ax, %0\n"
|
178 | e16c53fa | bellard | #else
|
179 | e16c53fa | bellard | #error unsupported size
|
180 | e16c53fa | bellard | #endif
|
181 | e16c53fa | bellard | "jmp 2f\n"
|
182 | e16c53fa | bellard | "1:\n"
|
183 | 84b7b8e7 | bellard | "addl 12(%%edx), %%eax\n"
|
184 | e16c53fa | bellard | #if DATA_SIZE == 1 |
185 | e16c53fa | bellard | "movsbl (%%eax), %0\n"
|
186 | e16c53fa | bellard | #elif DATA_SIZE == 2 |
187 | e16c53fa | bellard | "movswl (%%eax), %0\n"
|
188 | e16c53fa | bellard | #else
|
189 | e16c53fa | bellard | #error unsupported size
|
190 | e16c53fa | bellard | #endif
|
191 | e16c53fa | bellard | "2:\n"
|
192 | e16c53fa | bellard | : "=r" (res)
|
193 | e16c53fa | bellard | : "r" (ptr),
|
194 | 84b7b8e7 | bellard | "i" ((CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS), |
195 | 84b7b8e7 | bellard | "i" (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS),
|
196 | e16c53fa | bellard | "i" (TARGET_PAGE_MASK | (DATA_SIZE - 1)), |
197 | 84b7b8e7 | bellard | "m" (*(uint32_t *)offsetof(CPUState, tlb_table[CPU_MEM_INDEX][0].addr_read)), |
198 | e16c53fa | bellard | "i" (CPU_MEM_INDEX),
|
199 | e16c53fa | bellard | "m" (*(uint8_t *)&glue(glue(__ld, SUFFIX), MMUSUFFIX))
|
200 | e16c53fa | bellard | : "%eax", "%ecx", "%edx", "memory", "cc"); |
201 | e16c53fa | bellard | return res;
|
202 | e16c53fa | bellard | } |
203 | e16c53fa | bellard | #endif
|
204 | e16c53fa | bellard | |
205 | c27004ec | bellard | static inline void glue(glue(st, SUFFIX), MEMSUFFIX)(target_ulong ptr, RES_TYPE v) |
206 | e16c53fa | bellard | { |
207 | e16c53fa | bellard | asm volatile ("movl %0, %%edx\n" |
208 | e16c53fa | bellard | "movl %0, %%eax\n"
|
209 | e16c53fa | bellard | "shrl %3, %%edx\n"
|
210 | e16c53fa | bellard | "andl %4, %%eax\n"
|
211 | e16c53fa | bellard | "andl %2, %%edx\n"
|
212 | e16c53fa | bellard | "leal %5(%%edx, %%ebp), %%edx\n"
|
213 | e16c53fa | bellard | "cmpl (%%edx), %%eax\n"
|
214 | e16c53fa | bellard | "movl %0, %%eax\n"
|
215 | e16c53fa | bellard | "je 1f\n"
|
216 | e16c53fa | bellard | #if DATA_SIZE == 1 |
217 | e16c53fa | bellard | "movzbl %b1, %%edx\n"
|
218 | e16c53fa | bellard | #elif DATA_SIZE == 2 |
219 | e16c53fa | bellard | "movzwl %w1, %%edx\n"
|
220 | e16c53fa | bellard | #elif DATA_SIZE == 4 |
221 | e16c53fa | bellard | "movl %1, %%edx\n"
|
222 | e16c53fa | bellard | #else
|
223 | e16c53fa | bellard | #error unsupported size
|
224 | e16c53fa | bellard | #endif
|
225 | e16c53fa | bellard | "pushl %6\n"
|
226 | e16c53fa | bellard | "call %7\n"
|
227 | e16c53fa | bellard | "popl %%eax\n"
|
228 | e16c53fa | bellard | "jmp 2f\n"
|
229 | e16c53fa | bellard | "1:\n"
|
230 | 84b7b8e7 | bellard | "addl 8(%%edx), %%eax\n"
|
231 | e16c53fa | bellard | #if DATA_SIZE == 1 |
232 | e16c53fa | bellard | "movb %b1, (%%eax)\n"
|
233 | e16c53fa | bellard | #elif DATA_SIZE == 2 |
234 | e16c53fa | bellard | "movw %w1, (%%eax)\n"
|
235 | e16c53fa | bellard | #elif DATA_SIZE == 4 |
236 | e16c53fa | bellard | "movl %1, (%%eax)\n"
|
237 | e16c53fa | bellard | #else
|
238 | e16c53fa | bellard | #error unsupported size
|
239 | e16c53fa | bellard | #endif
|
240 | e16c53fa | bellard | "2:\n"
|
241 | e16c53fa | bellard | : |
242 | e16c53fa | bellard | : "r" (ptr),
|
243 | e16c53fa | bellard | /* NOTE: 'q' would be needed as constraint, but we could not use it
|
244 | e16c53fa | bellard | with T1 ! */
|
245 | e16c53fa | bellard | "r" (v),
|
246 | 84b7b8e7 | bellard | "i" ((CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS), |
247 | 84b7b8e7 | bellard | "i" (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS),
|
248 | e16c53fa | bellard | "i" (TARGET_PAGE_MASK | (DATA_SIZE - 1)), |
249 | 84b7b8e7 | bellard | "m" (*(uint32_t *)offsetof(CPUState, tlb_table[CPU_MEM_INDEX][0].addr_write)), |
250 | e16c53fa | bellard | "i" (CPU_MEM_INDEX),
|
251 | e16c53fa | bellard | "m" (*(uint8_t *)&glue(glue(__st, SUFFIX), MMUSUFFIX))
|
252 | e16c53fa | bellard | : "%eax", "%ecx", "%edx", "memory", "cc"); |
253 | e16c53fa | bellard | } |
254 | e16c53fa | bellard | |
255 | e16c53fa | bellard | #else
|
256 | e16c53fa | bellard | |
257 | e16c53fa | bellard | /* generic load/store macros */
|
258 | e16c53fa | bellard | |
259 | c27004ec | bellard | static inline RES_TYPE glue(glue(ld, USUFFIX), MEMSUFFIX)(target_ulong ptr) |
260 | b92e5a22 | bellard | { |
261 | b92e5a22 | bellard | int index;
|
262 | b92e5a22 | bellard | RES_TYPE res; |
263 | c27004ec | bellard | target_ulong addr; |
264 | c27004ec | bellard | unsigned long physaddr; |
265 | 61382a50 | bellard | int is_user;
|
266 | 61382a50 | bellard | |
267 | c27004ec | bellard | addr = ptr; |
268 | b92e5a22 | bellard | index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
|
269 | 61382a50 | bellard | is_user = CPU_MEM_INDEX; |
270 | 84b7b8e7 | bellard | if (__builtin_expect(env->tlb_table[is_user][index].ADDR_READ !=
|
271 | b92e5a22 | bellard | (addr & (TARGET_PAGE_MASK | (DATA_SIZE - 1))), 0)) { |
272 | 61382a50 | bellard | res = glue(glue(__ld, SUFFIX), MMUSUFFIX)(addr, is_user); |
273 | b92e5a22 | bellard | } else {
|
274 | 84b7b8e7 | bellard | physaddr = addr + env->tlb_table[is_user][index].addend; |
275 | 61382a50 | bellard | res = glue(glue(ld, USUFFIX), _raw)((uint8_t *)physaddr); |
276 | b92e5a22 | bellard | } |
277 | b92e5a22 | bellard | return res;
|
278 | b92e5a22 | bellard | } |
279 | b92e5a22 | bellard | |
280 | b92e5a22 | bellard | #if DATA_SIZE <= 2 |
281 | c27004ec | bellard | static inline int glue(glue(lds, SUFFIX), MEMSUFFIX)(target_ulong ptr) |
282 | b92e5a22 | bellard | { |
283 | b92e5a22 | bellard | int res, index;
|
284 | c27004ec | bellard | target_ulong addr; |
285 | c27004ec | bellard | unsigned long physaddr; |
286 | 61382a50 | bellard | int is_user;
|
287 | 61382a50 | bellard | |
288 | c27004ec | bellard | addr = ptr; |
289 | b92e5a22 | bellard | index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
|
290 | 61382a50 | bellard | is_user = CPU_MEM_INDEX; |
291 | 84b7b8e7 | bellard | if (__builtin_expect(env->tlb_table[is_user][index].ADDR_READ !=
|
292 | b92e5a22 | bellard | (addr & (TARGET_PAGE_MASK | (DATA_SIZE - 1))), 0)) { |
293 | 61382a50 | bellard | res = (DATA_STYPE)glue(glue(__ld, SUFFIX), MMUSUFFIX)(addr, is_user); |
294 | b92e5a22 | bellard | } else {
|
295 | 84b7b8e7 | bellard | physaddr = addr + env->tlb_table[is_user][index].addend; |
296 | b92e5a22 | bellard | res = glue(glue(lds, SUFFIX), _raw)((uint8_t *)physaddr); |
297 | b92e5a22 | bellard | } |
298 | b92e5a22 | bellard | return res;
|
299 | b92e5a22 | bellard | } |
300 | b92e5a22 | bellard | #endif
|
301 | b92e5a22 | bellard | |
302 | 84b7b8e7 | bellard | #if ACCESS_TYPE != 3 |
303 | 84b7b8e7 | bellard | |
304 | e16c53fa | bellard | /* generic store macro */
|
305 | e16c53fa | bellard | |
306 | c27004ec | bellard | static inline void glue(glue(st, SUFFIX), MEMSUFFIX)(target_ulong ptr, RES_TYPE v) |
307 | b92e5a22 | bellard | { |
308 | b92e5a22 | bellard | int index;
|
309 | c27004ec | bellard | target_ulong addr; |
310 | c27004ec | bellard | unsigned long physaddr; |
311 | 61382a50 | bellard | int is_user;
|
312 | 61382a50 | bellard | |
313 | c27004ec | bellard | addr = ptr; |
314 | b92e5a22 | bellard | index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
|
315 | 61382a50 | bellard | is_user = CPU_MEM_INDEX; |
316 | 84b7b8e7 | bellard | if (__builtin_expect(env->tlb_table[is_user][index].addr_write !=
|
317 | b92e5a22 | bellard | (addr & (TARGET_PAGE_MASK | (DATA_SIZE - 1))), 0)) { |
318 | 61382a50 | bellard | glue(glue(__st, SUFFIX), MMUSUFFIX)(addr, v, is_user); |
319 | b92e5a22 | bellard | } else {
|
320 | 84b7b8e7 | bellard | physaddr = addr + env->tlb_table[is_user][index].addend; |
321 | b92e5a22 | bellard | glue(glue(st, SUFFIX), _raw)((uint8_t *)physaddr, v); |
322 | b92e5a22 | bellard | } |
323 | b92e5a22 | bellard | } |
324 | b92e5a22 | bellard | |
325 | 84b7b8e7 | bellard | #endif /* ACCESS_TYPE != 3 */ |
326 | 84b7b8e7 | bellard | |
327 | 84b7b8e7 | bellard | #endif /* !asm */ |
328 | 84b7b8e7 | bellard | |
329 | 84b7b8e7 | bellard | #if ACCESS_TYPE != 3 |
330 | e16c53fa | bellard | |
331 | 2d603d22 | bellard | #if DATA_SIZE == 8 |
332 | 3f87bf69 | bellard | static inline float64 glue(ldfq, MEMSUFFIX)(target_ulong ptr) |
333 | 2d603d22 | bellard | { |
334 | 2d603d22 | bellard | union {
|
335 | 3f87bf69 | bellard | float64 d; |
336 | 2d603d22 | bellard | uint64_t i; |
337 | 2d603d22 | bellard | } u; |
338 | 2d603d22 | bellard | u.i = glue(ldq, MEMSUFFIX)(ptr); |
339 | 2d603d22 | bellard | return u.d;
|
340 | 2d603d22 | bellard | } |
341 | 2d603d22 | bellard | |
342 | 3f87bf69 | bellard | static inline void glue(stfq, MEMSUFFIX)(target_ulong ptr, float64 v) |
343 | 2d603d22 | bellard | { |
344 | 2d603d22 | bellard | union {
|
345 | 3f87bf69 | bellard | float64 d; |
346 | 2d603d22 | bellard | uint64_t i; |
347 | 2d603d22 | bellard | } u; |
348 | 2d603d22 | bellard | u.d = v; |
349 | 2d603d22 | bellard | glue(stq, MEMSUFFIX)(ptr, u.i); |
350 | 2d603d22 | bellard | } |
351 | 2d603d22 | bellard | #endif /* DATA_SIZE == 8 */ |
352 | 2d603d22 | bellard | |
353 | 2d603d22 | bellard | #if DATA_SIZE == 4 |
354 | 3f87bf69 | bellard | static inline float32 glue(ldfl, MEMSUFFIX)(target_ulong ptr) |
355 | 2d603d22 | bellard | { |
356 | 2d603d22 | bellard | union {
|
357 | 3f87bf69 | bellard | float32 f; |
358 | 2d603d22 | bellard | uint32_t i; |
359 | 2d603d22 | bellard | } u; |
360 | 2d603d22 | bellard | u.i = glue(ldl, MEMSUFFIX)(ptr); |
361 | 2d603d22 | bellard | return u.f;
|
362 | 2d603d22 | bellard | } |
363 | 2d603d22 | bellard | |
364 | 3f87bf69 | bellard | static inline void glue(stfl, MEMSUFFIX)(target_ulong ptr, float32 v) |
365 | 2d603d22 | bellard | { |
366 | 2d603d22 | bellard | union {
|
367 | 3f87bf69 | bellard | float32 f; |
368 | 2d603d22 | bellard | uint32_t i; |
369 | 2d603d22 | bellard | } u; |
370 | 2d603d22 | bellard | u.f = v; |
371 | 2d603d22 | bellard | glue(stl, MEMSUFFIX)(ptr, u.i); |
372 | 2d603d22 | bellard | } |
373 | 2d603d22 | bellard | #endif /* DATA_SIZE == 4 */ |
374 | 2d603d22 | bellard | |
375 | 84b7b8e7 | bellard | #endif /* ACCESS_TYPE != 3 */ |
376 | 84b7b8e7 | bellard | |
377 | b92e5a22 | bellard | #undef RES_TYPE
|
378 | b92e5a22 | bellard | #undef DATA_TYPE
|
379 | b92e5a22 | bellard | #undef DATA_STYPE
|
380 | b92e5a22 | bellard | #undef SUFFIX
|
381 | 61382a50 | bellard | #undef USUFFIX
|
382 | b92e5a22 | bellard | #undef DATA_SIZE
|
383 | 61382a50 | bellard | #undef CPU_MEM_INDEX
|
384 | 61382a50 | bellard | #undef MMUSUFFIX
|
385 | 84b7b8e7 | bellard | #undef ADDR_READ |