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