root / target-ppc / op_helper_mem.h @ 4ad5b06d
History | View | Annotate | Download (2.3 kB)
1 | 9a64fbe4 | bellard | void glue(do_lsw, MEMSUFFIX) (int dst) |
---|---|---|---|
2 | 9a64fbe4 | bellard | { |
3 | 9a64fbe4 | bellard | uint32_t tmp; |
4 | 9a64fbe4 | bellard | int sh;
|
5 | 9a64fbe4 | bellard | |
6 | 71be0fc3 | bellard | #if 0
|
7 | 7c48011b | bellard | if (loglevel > 0) {
|
8 | 7c48011b | bellard | fprintf(logfile, "%s: addr=0x%08x count=%d reg=%d\n",
|
9 | 7c48011b | bellard | __func__, T0, T1, dst);
|
10 | 7c48011b | bellard | }
|
11 | 71be0fc3 | bellard | #endif
|
12 | 9a64fbe4 | bellard | for (; T1 > 3; T1 -= 4, T0 += 4) { |
13 | 0fa85d43 | bellard | ugpr(dst++) = glue(ldl, MEMSUFFIX)(T0); |
14 | 9a64fbe4 | bellard | if (dst == 32) |
15 | 9a64fbe4 | bellard | dst = 0;
|
16 | 9a64fbe4 | bellard | } |
17 | 9a64fbe4 | bellard | if (T1 > 0) { |
18 | 9a64fbe4 | bellard | tmp = 0;
|
19 | 9a64fbe4 | bellard | for (sh = 24; T1 > 0; T1--, T0++, sh -= 8) { |
20 | 0fa85d43 | bellard | tmp |= glue(ldub, MEMSUFFIX)(T0) << sh; |
21 | 9a64fbe4 | bellard | } |
22 | 9a64fbe4 | bellard | ugpr(dst) = tmp; |
23 | 9a64fbe4 | bellard | } |
24 | 9a64fbe4 | bellard | } |
25 | 9a64fbe4 | bellard | |
26 | 9a64fbe4 | bellard | void glue(do_stsw, MEMSUFFIX) (int src) |
27 | 9a64fbe4 | bellard | { |
28 | 9a64fbe4 | bellard | int sh;
|
29 | 9a64fbe4 | bellard | |
30 | 71be0fc3 | bellard | #if 0
|
31 | 7c48011b | bellard | if (loglevel > 0) {
|
32 | 7c48011b | bellard | fprintf(logfile, "%s: addr=0x%08x count=%d reg=%d\n",
|
33 | 7c48011b | bellard | __func__, T0, T1, src);
|
34 | 7c48011b | bellard | }
|
35 | 71be0fc3 | bellard | #endif
|
36 | 9a64fbe4 | bellard | for (; T1 > 3; T1 -= 4, T0 += 4) { |
37 | 0fa85d43 | bellard | glue(stl, MEMSUFFIX)(T0, ugpr(src++)); |
38 | 9a64fbe4 | bellard | if (src == 32) |
39 | 9a64fbe4 | bellard | src = 0;
|
40 | 9a64fbe4 | bellard | } |
41 | 9a64fbe4 | bellard | if (T1 > 0) { |
42 | 9a64fbe4 | bellard | for (sh = 24; T1 > 0; T1--, T0++, sh -= 8) |
43 | 0fa85d43 | bellard | glue(stb, MEMSUFFIX)(T0, (ugpr(src) >> sh) & 0xFF);
|
44 | 9a64fbe4 | bellard | } |
45 | 9a64fbe4 | bellard | } |
46 | 9a64fbe4 | bellard | |
47 | 111bfab3 | bellard | void glue(do_lsw_le, MEMSUFFIX) (int dst) |
48 | 111bfab3 | bellard | { |
49 | 111bfab3 | bellard | uint32_t tmp; |
50 | 111bfab3 | bellard | int sh;
|
51 | 111bfab3 | bellard | |
52 | 71be0fc3 | bellard | #if 0
|
53 | 7c48011b | bellard | if (loglevel > 0) {
|
54 | 111bfab3 | bellard | fprintf(logfile, "%s: addr=0x%08x count=%d reg=%d\n",
|
55 | 111bfab3 | bellard | __func__, T0, T1, dst);
|
56 | 7c48011b | bellard | }
|
57 | 71be0fc3 | bellard | #endif
|
58 | 111bfab3 | bellard | for (; T1 > 3; T1 -= 4, T0 += 4) { |
59 | 111bfab3 | bellard | tmp = glue(ldl, MEMSUFFIX)(T0); |
60 | 111bfab3 | bellard | ugpr(dst++) = ((tmp & 0xFF000000) >> 24) | ((tmp & 0x00FF0000) >> 8) | |
61 | 111bfab3 | bellard | ((tmp & 0x0000FF00) << 8) | ((tmp & 0x000000FF) << 24); |
62 | 111bfab3 | bellard | if (dst == 32) |
63 | 111bfab3 | bellard | dst = 0;
|
64 | 111bfab3 | bellard | } |
65 | 111bfab3 | bellard | if (T1 > 0) { |
66 | 111bfab3 | bellard | tmp = 0;
|
67 | 111bfab3 | bellard | for (sh = 0; T1 > 0; T1--, T0++, sh += 8) { |
68 | 111bfab3 | bellard | tmp |= glue(ldub, MEMSUFFIX)(T0) << sh; |
69 | 111bfab3 | bellard | } |
70 | 111bfab3 | bellard | ugpr(dst) = tmp; |
71 | 111bfab3 | bellard | } |
72 | 111bfab3 | bellard | } |
73 | 111bfab3 | bellard | |
74 | 111bfab3 | bellard | void glue(do_stsw_le, MEMSUFFIX) (int src) |
75 | 111bfab3 | bellard | { |
76 | 111bfab3 | bellard | uint32_t tmp; |
77 | 111bfab3 | bellard | int sh;
|
78 | 111bfab3 | bellard | |
79 | 71be0fc3 | bellard | #if 0
|
80 | 7c48011b | bellard | if (loglevel > 0) {
|
81 | 111bfab3 | bellard | fprintf(logfile, "%s: addr=0x%08x count=%d reg=%d\n",
|
82 | 111bfab3 | bellard | __func__, T0, T1, src);
|
83 | 7c48011b | bellard | }
|
84 | 71be0fc3 | bellard | #endif
|
85 | 111bfab3 | bellard | for (; T1 > 3; T1 -= 4, T0 += 4) { |
86 | 111bfab3 | bellard | tmp = ((ugpr(src++) & 0xFF000000) >> 24); |
87 | 111bfab3 | bellard | tmp |= ((ugpr(src++) & 0x00FF0000) >> 8); |
88 | 111bfab3 | bellard | tmp |= ((ugpr(src++) & 0x0000FF00) << 8); |
89 | 111bfab3 | bellard | tmp |= ((ugpr(src++) & 0x000000FF) << 24); |
90 | 111bfab3 | bellard | glue(stl, MEMSUFFIX)(T0, tmp); |
91 | 111bfab3 | bellard | if (src == 32) |
92 | 111bfab3 | bellard | src = 0;
|
93 | 111bfab3 | bellard | } |
94 | 111bfab3 | bellard | if (T1 > 0) { |
95 | 111bfab3 | bellard | for (sh = 0; T1 > 0; T1--, T0++, sh += 8) |
96 | 111bfab3 | bellard | glue(stb, MEMSUFFIX)(T0, (ugpr(src) >> sh) & 0xFF);
|
97 | 111bfab3 | bellard | } |
98 | 111bfab3 | bellard | } |
99 | 111bfab3 | bellard | |
100 | 9a64fbe4 | bellard | #undef MEMSUFFIX |