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
This commit is contained in:
ths 2007-01-01 20:34:37 +00:00
parent 7495fd0f4a
commit 3a3f24fce8

View File

@ -1,3 +1,5 @@
#undef DEBUG_OP
#ifdef TARGET_WORDS_BIGENDIAN #ifdef TARGET_WORDS_BIGENDIAN
#define GET_LMASK(v) ((v) & 3) #define GET_LMASK(v) ((v) & 3)
#else #else
@ -12,21 +14,21 @@ void glue(do_lwl, MEMSUFFIX) (uint32_t tmp)
switch (GET_LMASK(T0)) { switch (GET_LMASK(T0)) {
case 0: case 0:
T0 = tmp; T0 = (int32_t)tmp;
break; break;
case 1: case 1:
T0 = (tmp << 8) | (T1 & 0x000000FF); T0 = (int32_t)((tmp << 8) | (T1 & 0x000000FF));
break; break;
case 2: case 2:
T0 = (tmp << 16) | (T1 & 0x0000FFFF); T0 = (int32_t)((tmp << 16) | (T1 & 0x0000FFFF));
break; break;
case 3: case 3:
T0 = (tmp << 24) | (T1 & 0x00FFFFFF); T0 = (int32_t)((tmp << 24) | (T1 & 0x00FFFFFF));
break; break;
} }
#if defined (DEBUG_OP) #if defined (DEBUG_OP)
if (logfile) { if (logfile) {
fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", fprintf(logfile, "%s: " TLSZ " - %08x " TLSZ " => " TLSZ "\n",
__func__, sav, tmp, T1, T0); __func__, sav, tmp, T1, T0);
} }
#endif #endif
@ -41,21 +43,21 @@ void glue(do_lwr, MEMSUFFIX) (uint32_t tmp)
switch (GET_LMASK(T0)) { switch (GET_LMASK(T0)) {
case 0: case 0:
T0 = (tmp >> 24) | (T1 & 0xFFFFFF00); T0 = (int32_t)((tmp >> 24) | (T1 & 0xFFFFFF00));
break; break;
case 1: case 1:
T0 = (tmp >> 16) | (T1 & 0xFFFF0000); T0 = (int32_t)((tmp >> 16) | (T1 & 0xFFFF0000));
break; break;
case 2: case 2:
T0 = (tmp >> 8) | (T1 & 0xFF000000); T0 = (int32_t)((tmp >> 8) | (T1 & 0xFF000000));
break; break;
case 3: case 3:
T0 = tmp; T0 = (int32_t)tmp;
break; break;
} }
#if defined (DEBUG_OP) #if defined (DEBUG_OP)
if (logfile) { if (logfile) {
fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", fprintf(logfile, "%s: " TLSZ " - %08x " TLSZ " => " TLSZ "\n",
__func__, sav, tmp, T1, T0); __func__, sav, tmp, T1, T0);
} }
#endif #endif
@ -70,21 +72,21 @@ uint32_t glue(do_swl, MEMSUFFIX) (uint32_t tmp)
switch (GET_LMASK(T0)) { switch (GET_LMASK(T0)) {
case 0: case 0:
tmp = T1; tmp = (int32_t)T1;
break; break;
case 1: case 1:
tmp = (tmp & 0xFF000000) | (T1 >> 8); tmp = (int32_t)((tmp & 0xFF000000) | ((uint32_t)T1 >> 8));
break; break;
case 2: case 2:
tmp = (tmp & 0xFFFF0000) | (T1 >> 16); tmp = (int32_t)((tmp & 0xFFFF0000) | ((uint32_t)T1 >> 16));
break; break;
case 3: case 3:
tmp = (tmp & 0xFFFFFF00) | (T1 >> 24); tmp = (int32_t)((tmp & 0xFFFFFF00) | ((uint32_t)T1 >> 24));
break; break;
} }
#if defined (DEBUG_OP) #if defined (DEBUG_OP)
if (logfile) { if (logfile) {
fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => %08x\n",
__func__, T0, sav, T1, tmp); __func__, T0, sav, T1, tmp);
} }
#endif #endif
@ -100,21 +102,21 @@ uint32_t glue(do_swr, MEMSUFFIX) (uint32_t tmp)
switch (GET_LMASK(T0)) { switch (GET_LMASK(T0)) {
case 0: case 0:
tmp = (tmp & 0x00FFFFFF) | (T1 << 24); tmp = (int32_t)((tmp & 0x00FFFFFF) | (T1 << 24));
break; break;
case 1: case 1:
tmp = (tmp & 0x0000FFFF) | (T1 << 16); tmp = (int32_t)((tmp & 0x0000FFFF) | (T1 << 16));
break; break;
case 2: case 2:
tmp = (tmp & 0x000000FF) | (T1 << 8); tmp = (int32_t)((tmp & 0x000000FF) | (T1 << 8));
break; break;
case 3: case 3:
tmp = T1; tmp = (int32_t)T1;
break; break;
} }
#if defined (DEBUG_OP) #if defined (DEBUG_OP)
if (logfile) { if (logfile) {
fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => %08x\n",
__func__, T0, sav, T1, tmp); __func__, T0, sav, T1, tmp);
} }
#endif #endif
@ -164,7 +166,7 @@ void glue(do_ldl, MEMSUFFIX) (uint64_t tmp)
} }
#if defined (DEBUG_OP) #if defined (DEBUG_OP)
if (logfile) { if (logfile) {
fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => " TLSZ "\n",
__func__, sav, tmp, T1, T0); __func__, sav, tmp, T1, T0);
} }
#endif #endif
@ -205,7 +207,7 @@ void glue(do_ldr, MEMSUFFIX) (uint64_t tmp)
} }
#if defined (DEBUG_OP) #if defined (DEBUG_OP)
if (logfile) { if (logfile) {
fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => " TLSZ "\n",
__func__, sav, tmp, T1, T0); __func__, sav, tmp, T1, T0);
} }
#endif #endif
@ -246,7 +248,7 @@ uint64_t glue(do_sdl, MEMSUFFIX) (uint64_t tmp)
} }
#if defined (DEBUG_OP) #if defined (DEBUG_OP)
if (logfile) { if (logfile) {
fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => " TLSZ "\n",
__func__, T0, sav, T1, tmp); __func__, T0, sav, T1, tmp);
} }
#endif #endif
@ -288,7 +290,7 @@ uint64_t glue(do_sdr, MEMSUFFIX) (uint64_t tmp)
} }
#if defined (DEBUG_OP) #if defined (DEBUG_OP)
if (logfile) { if (logfile) {
fprintf(logfile, "%s: %08x - %08x %08x => %08x\n", fprintf(logfile, "%s: " TLSZ " - " TLSZ " " TLSZ " => " TLSZ "\n",
__func__, T0, sav, T1, tmp); __func__, T0, sav, T1, tmp);
} }
#endif #endif