Commit 3a3f24fce80c1516fe03e0d4c73505ef6dbaa21c
1 parent
7495fd0f
Fix lwl/lwr for 64bit emulation, also debug output spec for 64bit emulation.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2283 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
26 additions
and
24 deletions
target-mips/op_helper_mem.c
1 | +#undef DEBUG_OP | |
2 | + | |
1 | 3 | #ifdef TARGET_WORDS_BIGENDIAN |
2 | 4 | #define GET_LMASK(v) ((v) & 3) |
3 | 5 | #else |
... | ... | @@ -12,21 +14,21 @@ void glue(do_lwl, MEMSUFFIX) (uint32_t tmp) |
12 | 14 | |
13 | 15 | switch (GET_LMASK(T0)) { |
14 | 16 | case 0: |
15 | - T0 = tmp; | |
17 | + T0 = (int32_t)tmp; | |
16 | 18 | break; |
17 | 19 | case 1: |
18 | - T0 = (tmp << 8) | (T1 & 0x000000FF); | |
20 | + T0 = (int32_t)((tmp << 8) | (T1 & 0x000000FF)); | |
19 | 21 | break; |
20 | 22 | case 2: |
21 | - T0 = (tmp << 16) | (T1 & 0x0000FFFF); | |
23 | + T0 = (int32_t)((tmp << 16) | (T1 & 0x0000FFFF)); | |
22 | 24 | break; |
23 | 25 | case 3: |
24 | - T0 = (tmp << 24) | (T1 & 0x00FFFFFF); | |
26 | + T0 = (int32_t)((tmp << 24) | (T1 & 0x00FFFFFF)); | |
25 | 27 | break; |
26 | 28 | } |
27 | 29 | #if defined (DEBUG_OP) |
28 | 30 | if (logfile) { |
29 | - fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", | |
31 | + fprintf(logfile, "%s: " TLSZ " - %08x " TLSZ " => " TLSZ "\n", | |
30 | 32 | __func__, sav, tmp, T1, T0); |
31 | 33 | } |
32 | 34 | #endif |
... | ... | @@ -41,21 +43,21 @@ void glue(do_lwr, MEMSUFFIX) (uint32_t tmp) |
41 | 43 | |
42 | 44 | switch (GET_LMASK(T0)) { |
43 | 45 | case 0: |
44 | - T0 = (tmp >> 24) | (T1 & 0xFFFFFF00); | |
46 | + T0 = (int32_t)((tmp >> 24) | (T1 & 0xFFFFFF00)); | |
45 | 47 | break; |
46 | 48 | case 1: |
47 | - T0 = (tmp >> 16) | (T1 & 0xFFFF0000); | |
49 | + T0 = (int32_t)((tmp >> 16) | (T1 & 0xFFFF0000)); | |
48 | 50 | break; |
49 | 51 | case 2: |
50 | - T0 = (tmp >> 8) | (T1 & 0xFF000000); | |
52 | + T0 = (int32_t)((tmp >> 8) | (T1 & 0xFF000000)); | |
51 | 53 | break; |
52 | 54 | case 3: |
53 | - T0 = tmp; | |
55 | + T0 = (int32_t)tmp; | |
54 | 56 | break; |
55 | 57 | } |
56 | 58 | #if defined (DEBUG_OP) |
57 | 59 | if (logfile) { |
58 | - fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", | |
60 | + fprintf(logfile, "%s: " TLSZ " - %08x " TLSZ " => " TLSZ "\n", | |
59 | 61 | __func__, sav, tmp, T1, T0); |
60 | 62 | } |
61 | 63 | #endif |
... | ... | @@ -70,21 +72,21 @@ uint32_t glue(do_swl, MEMSUFFIX) (uint32_t tmp) |
70 | 72 | |
71 | 73 | switch (GET_LMASK(T0)) { |
72 | 74 | case 0: |
73 | - tmp = T1; | |
75 | + tmp = (int32_t)T1; | |
74 | 76 | break; |
75 | 77 | case 1: |
76 | - tmp = (tmp & 0xFF000000) | (T1 >> 8); | |
78 | + tmp = (int32_t)((tmp & 0xFF000000) | ((uint32_t)T1 >> 8)); | |
77 | 79 | break; |
78 | 80 | case 2: |
79 | - tmp = (tmp & 0xFFFF0000) | (T1 >> 16); | |
81 | + tmp = (int32_t)((tmp & 0xFFFF0000) | ((uint32_t)T1 >> 16)); | |
80 | 82 | break; |
81 | 83 | case 3: |
82 | - tmp = (tmp & 0xFFFFFF00) | (T1 >> 24); | |
84 | + tmp = (int32_t)((tmp & 0xFFFFFF00) | ((uint32_t)T1 >> 24)); | |
83 | 85 | break; |
84 | 86 | } |
85 | 87 | #if defined (DEBUG_OP) |
86 | 88 | if (logfile) { |
87 | - fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", | |
89 | + fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => %08x\n", | |
88 | 90 | __func__, T0, sav, T1, tmp); |
89 | 91 | } |
90 | 92 | #endif |
... | ... | @@ -100,21 +102,21 @@ uint32_t glue(do_swr, MEMSUFFIX) (uint32_t tmp) |
100 | 102 | |
101 | 103 | switch (GET_LMASK(T0)) { |
102 | 104 | case 0: |
103 | - tmp = (tmp & 0x00FFFFFF) | (T1 << 24); | |
105 | + tmp = (int32_t)((tmp & 0x00FFFFFF) | (T1 << 24)); | |
104 | 106 | break; |
105 | 107 | case 1: |
106 | - tmp = (tmp & 0x0000FFFF) | (T1 << 16); | |
108 | + tmp = (int32_t)((tmp & 0x0000FFFF) | (T1 << 16)); | |
107 | 109 | break; |
108 | 110 | case 2: |
109 | - tmp = (tmp & 0x000000FF) | (T1 << 8); | |
111 | + tmp = (int32_t)((tmp & 0x000000FF) | (T1 << 8)); | |
110 | 112 | break; |
111 | 113 | case 3: |
112 | - tmp = T1; | |
114 | + tmp = (int32_t)T1; | |
113 | 115 | break; |
114 | 116 | } |
115 | 117 | #if defined (DEBUG_OP) |
116 | 118 | if (logfile) { |
117 | - fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", | |
119 | + fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => %08x\n", | |
118 | 120 | __func__, T0, sav, T1, tmp); |
119 | 121 | } |
120 | 122 | #endif |
... | ... | @@ -164,7 +166,7 @@ void glue(do_ldl, MEMSUFFIX) (uint64_t tmp) |
164 | 166 | } |
165 | 167 | #if defined (DEBUG_OP) |
166 | 168 | if (logfile) { |
167 | - fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", | |
169 | + fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => " TLSZ "\n", | |
168 | 170 | __func__, sav, tmp, T1, T0); |
169 | 171 | } |
170 | 172 | #endif |
... | ... | @@ -205,7 +207,7 @@ void glue(do_ldr, MEMSUFFIX) (uint64_t tmp) |
205 | 207 | } |
206 | 208 | #if defined (DEBUG_OP) |
207 | 209 | if (logfile) { |
208 | - fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", | |
210 | + fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => " TLSZ "\n", | |
209 | 211 | __func__, sav, tmp, T1, T0); |
210 | 212 | } |
211 | 213 | #endif |
... | ... | @@ -246,7 +248,7 @@ uint64_t glue(do_sdl, MEMSUFFIX) (uint64_t tmp) |
246 | 248 | } |
247 | 249 | #if defined (DEBUG_OP) |
248 | 250 | if (logfile) { |
249 | - fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", | |
251 | + fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => " TLSZ "\n", | |
250 | 252 | __func__, T0, sav, T1, tmp); |
251 | 253 | } |
252 | 254 | #endif |
... | ... | @@ -288,7 +290,7 @@ uint64_t glue(do_sdr, MEMSUFFIX) (uint64_t tmp) |
288 | 290 | } |
289 | 291 | #if defined (DEBUG_OP) |
290 | 292 | if (logfile) { |
291 | - fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", | |
293 | + fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => " TLSZ "\n", | |
292 | 294 | __func__, T0, sav, T1, tmp); |
293 | 295 | } |
294 | 296 | #endif | ... | ... |