Commit 943144d91af00c0ece95e1b2e64d8eed4d2c38ec
1 parent
34e01bbf
added raw/user/kernel memory accesses (faster emulation)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@510 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
51 additions
and
23 deletions
target-i386/ops_template_mem.h
... | ... | @@ -20,12 +20,40 @@ |
20 | 20 | */ |
21 | 21 | #ifdef MEM_WRITE |
22 | 22 | |
23 | +#if MEM_WRITE == 0 | |
24 | + | |
25 | +#if DATA_BITS == 8 | |
26 | +#define MEM_SUFFIX b_raw | |
27 | +#elif DATA_BITS == 16 | |
28 | +#define MEM_SUFFIX w_raw | |
29 | +#elif DATA_BITS == 32 | |
30 | +#define MEM_SUFFIX l_raw | |
31 | +#endif | |
32 | + | |
33 | +#elif MEM_WRITE == 1 | |
34 | + | |
35 | +#if DATA_BITS == 8 | |
36 | +#define MEM_SUFFIX b_kernel | |
37 | +#elif DATA_BITS == 16 | |
38 | +#define MEM_SUFFIX w_kernel | |
39 | +#elif DATA_BITS == 32 | |
40 | +#define MEM_SUFFIX l_kernel | |
41 | +#endif | |
42 | + | |
43 | +#elif MEM_WRITE == 2 | |
44 | + | |
23 | 45 | #if DATA_BITS == 8 |
24 | -#define MEM_SUFFIX b_mem | |
46 | +#define MEM_SUFFIX b_user | |
25 | 47 | #elif DATA_BITS == 16 |
26 | -#define MEM_SUFFIX w_mem | |
48 | +#define MEM_SUFFIX w_user | |
27 | 49 | #elif DATA_BITS == 32 |
28 | -#define MEM_SUFFIX l_mem | |
50 | +#define MEM_SUFFIX l_user | |
51 | +#endif | |
52 | + | |
53 | +#else | |
54 | + | |
55 | +#error invalid MEM_WRITE | |
56 | + | |
29 | 57 | #endif |
30 | 58 | |
31 | 59 | #else |
... | ... | @@ -43,7 +71,7 @@ void OPPROTO glue(glue(op_rol, MEM_SUFFIX), _T0_T1_cc)(void) |
43 | 71 | T0 &= DATA_MASK; |
44 | 72 | T0 = (T0 << count) | (T0 >> (DATA_BITS - count)); |
45 | 73 | #ifdef MEM_WRITE |
46 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
74 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
47 | 75 | #else |
48 | 76 | /* gcc 3.2 workaround. This is really a bug in gcc. */ |
49 | 77 | asm volatile("" : : "r" (T0)); |
... | ... | @@ -65,7 +93,7 @@ void OPPROTO glue(glue(op_ror, MEM_SUFFIX), _T0_T1_cc)(void) |
65 | 93 | T0 &= DATA_MASK; |
66 | 94 | T0 = (T0 >> count) | (T0 << (DATA_BITS - count)); |
67 | 95 | #ifdef MEM_WRITE |
68 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
96 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
69 | 97 | #else |
70 | 98 | /* gcc 3.2 workaround. This is really a bug in gcc. */ |
71 | 99 | asm volatile("" : : "r" (T0)); |
... | ... | @@ -86,7 +114,7 @@ void OPPROTO glue(glue(op_rol, MEM_SUFFIX), _T0_T1)(void) |
86 | 114 | T0 &= DATA_MASK; |
87 | 115 | T0 = (T0 << count) | (T0 >> (DATA_BITS - count)); |
88 | 116 | #ifdef MEM_WRITE |
89 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
117 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
90 | 118 | #endif |
91 | 119 | } |
92 | 120 | FORCE_RET(); |
... | ... | @@ -100,7 +128,7 @@ void OPPROTO glue(glue(op_ror, MEM_SUFFIX), _T0_T1)(void) |
100 | 128 | T0 &= DATA_MASK; |
101 | 129 | T0 = (T0 >> count) | (T0 << (DATA_BITS - count)); |
102 | 130 | #ifdef MEM_WRITE |
103 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
131 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
104 | 132 | #endif |
105 | 133 | } |
106 | 134 | FORCE_RET(); |
... | ... | @@ -126,7 +154,7 @@ void OPPROTO glue(glue(op_rcl, MEM_SUFFIX), _T0_T1_cc)(void) |
126 | 154 | res |= T0 >> (DATA_BITS + 1 - count); |
127 | 155 | T0 = res; |
128 | 156 | #ifdef MEM_WRITE |
129 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
157 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
130 | 158 | #endif |
131 | 159 | CC_SRC = (eflags & ~(CC_C | CC_O)) | |
132 | 160 | (lshift(src ^ T0, 11 - (DATA_BITS - 1)) & CC_O) | |
... | ... | @@ -156,7 +184,7 @@ void OPPROTO glue(glue(op_rcr, MEM_SUFFIX), _T0_T1_cc)(void) |
156 | 184 | res |= T0 << (DATA_BITS + 1 - count); |
157 | 185 | T0 = res; |
158 | 186 | #ifdef MEM_WRITE |
159 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
187 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
160 | 188 | #endif |
161 | 189 | CC_SRC = (eflags & ~(CC_C | CC_O)) | |
162 | 190 | (lshift(src ^ T0, 11 - (DATA_BITS - 1)) & CC_O) | |
... | ... | @@ -174,7 +202,7 @@ void OPPROTO glue(glue(op_shl, MEM_SUFFIX), _T0_T1_cc)(void) |
174 | 202 | src = (DATA_TYPE)T0 << (count - 1); |
175 | 203 | T0 = T0 << count; |
176 | 204 | #ifdef MEM_WRITE |
177 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
205 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
178 | 206 | #endif |
179 | 207 | CC_SRC = src; |
180 | 208 | CC_DST = T0; |
... | ... | @@ -192,7 +220,7 @@ void OPPROTO glue(glue(op_shr, MEM_SUFFIX), _T0_T1_cc)(void) |
192 | 220 | src = T0 >> (count - 1); |
193 | 221 | T0 = T0 >> count; |
194 | 222 | #ifdef MEM_WRITE |
195 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
223 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
196 | 224 | #endif |
197 | 225 | CC_SRC = src; |
198 | 226 | CC_DST = T0; |
... | ... | @@ -210,7 +238,7 @@ void OPPROTO glue(glue(op_sar, MEM_SUFFIX), _T0_T1_cc)(void) |
210 | 238 | T0 = src >> count; |
211 | 239 | src = src >> (count - 1); |
212 | 240 | #ifdef MEM_WRITE |
213 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
241 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
214 | 242 | #endif |
215 | 243 | CC_SRC = src; |
216 | 244 | CC_DST = T0; |
... | ... | @@ -234,7 +262,7 @@ void OPPROTO glue(glue(op_shld, MEM_SUFFIX), _T0_T1_im_cc)(void) |
234 | 262 | res |= T1 << (count - 16); |
235 | 263 | T0 = res >> 16; |
236 | 264 | #ifdef MEM_WRITE |
237 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
265 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
238 | 266 | #endif |
239 | 267 | CC_SRC = tmp; |
240 | 268 | CC_DST = T0; |
... | ... | @@ -254,7 +282,7 @@ void OPPROTO glue(glue(op_shld, MEM_SUFFIX), _T0_T1_ECX_cc)(void) |
254 | 282 | res |= T1 << (count - 16); |
255 | 283 | T0 = res >> 16; |
256 | 284 | #ifdef MEM_WRITE |
257 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
285 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
258 | 286 | #endif |
259 | 287 | CC_SRC = tmp; |
260 | 288 | CC_DST = T0; |
... | ... | @@ -276,7 +304,7 @@ void OPPROTO glue(glue(op_shrd, MEM_SUFFIX), _T0_T1_im_cc)(void) |
276 | 304 | res |= T1 << (32 - count); |
277 | 305 | T0 = res; |
278 | 306 | #ifdef MEM_WRITE |
279 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
307 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
280 | 308 | #endif |
281 | 309 | CC_SRC = tmp; |
282 | 310 | CC_DST = T0; |
... | ... | @@ -297,7 +325,7 @@ void OPPROTO glue(glue(op_shrd, MEM_SUFFIX), _T0_T1_ECX_cc)(void) |
297 | 325 | res |= T1 << (32 - count); |
298 | 326 | T0 = res; |
299 | 327 | #ifdef MEM_WRITE |
300 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
328 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
301 | 329 | #endif |
302 | 330 | CC_SRC = tmp; |
303 | 331 | CC_DST = T0; |
... | ... | @@ -317,7 +345,7 @@ void OPPROTO glue(glue(op_shld, MEM_SUFFIX), _T0_T1_im_cc)(void) |
317 | 345 | tmp = T0 << (count - 1); |
318 | 346 | T0 = (T0 << count) | (T1 >> (DATA_BITS - count)); |
319 | 347 | #ifdef MEM_WRITE |
320 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
348 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
321 | 349 | #endif |
322 | 350 | CC_SRC = tmp; |
323 | 351 | CC_DST = T0; |
... | ... | @@ -333,7 +361,7 @@ void OPPROTO glue(glue(op_shld, MEM_SUFFIX), _T0_T1_ECX_cc)(void) |
333 | 361 | tmp = T0 << (count - 1); |
334 | 362 | T0 = (T0 << count) | (T1 >> (DATA_BITS - count)); |
335 | 363 | #ifdef MEM_WRITE |
336 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
364 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
337 | 365 | #endif |
338 | 366 | CC_SRC = tmp; |
339 | 367 | CC_DST = T0; |
... | ... | @@ -351,7 +379,7 @@ void OPPROTO glue(glue(op_shrd, MEM_SUFFIX), _T0_T1_im_cc)(void) |
351 | 379 | tmp = T0 >> (count - 1); |
352 | 380 | T0 = (T0 >> count) | (T1 << (DATA_BITS - count)); |
353 | 381 | #ifdef MEM_WRITE |
354 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
382 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
355 | 383 | #endif |
356 | 384 | CC_SRC = tmp; |
357 | 385 | CC_DST = T0; |
... | ... | @@ -368,7 +396,7 @@ void OPPROTO glue(glue(op_shrd, MEM_SUFFIX), _T0_T1_ECX_cc)(void) |
368 | 396 | tmp = T0 >> (count - 1); |
369 | 397 | T0 = (T0 >> count) | (T1 << (DATA_BITS - count)); |
370 | 398 | #ifdef MEM_WRITE |
371 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
399 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
372 | 400 | #endif |
373 | 401 | CC_SRC = tmp; |
374 | 402 | CC_DST = T0; |
... | ... | @@ -386,7 +414,7 @@ void OPPROTO glue(glue(op_adc, MEM_SUFFIX), _T0_T1_cc)(void) |
386 | 414 | cf = cc_table[CC_OP].compute_c(); |
387 | 415 | T0 = T0 + T1 + cf; |
388 | 416 | #ifdef MEM_WRITE |
389 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
417 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
390 | 418 | #endif |
391 | 419 | CC_SRC = T1; |
392 | 420 | CC_DST = T0; |
... | ... | @@ -399,7 +427,7 @@ void OPPROTO glue(glue(op_sbb, MEM_SUFFIX), _T0_T1_cc)(void) |
399 | 427 | cf = cc_table[CC_OP].compute_c(); |
400 | 428 | T0 = T0 - T1 - cf; |
401 | 429 | #ifdef MEM_WRITE |
402 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
430 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
403 | 431 | #endif |
404 | 432 | CC_SRC = T1; |
405 | 433 | CC_DST = T0; |
... | ... | @@ -418,7 +446,7 @@ void OPPROTO glue(glue(op_cmpxchg, MEM_SUFFIX), _T0_T1_EAX_cc)(void) |
418 | 446 | EAX = (EAX & ~DATA_MASK) | (T0 & DATA_MASK); |
419 | 447 | } |
420 | 448 | #ifdef MEM_WRITE |
421 | - glue(st, SUFFIX)((uint8_t *)A0, T0); | |
449 | + glue(st, MEM_SUFFIX)((uint8_t *)A0, T0); | |
422 | 450 | #endif |
423 | 451 | CC_SRC = src; |
424 | 452 | CC_DST = dst; | ... | ... |