From: Robert Reif <reif@earthlink.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] sparc32 asi cleanups and debug printf
Date: Sat, 10 Nov 2007 13:28:15 -0500 [thread overview]
Message-ID: <4735F83F.6020607@earthlink.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 67 bytes --]
This patch makes debugging asi and mxcc accesses easier to follow.
[-- Attachment #2: asi.diff.txt --]
[-- Type: text/plain, Size: 10779 bytes --]
Index: target-sparc/op_helper.c
===================================================================
RCS file: /sources/qemu/qemu/target-sparc/op_helper.c,v
retrieving revision 1.51
diff -p -u -r1.51 op_helper.c
--- target-sparc/op_helper.c 7 Nov 2007 17:03:37 -0000 1.51
+++ target-sparc/op_helper.c 10 Nov 2007 18:22:34 -0000
@@ -6,6 +6,7 @@
//#define DEBUG_MXCC
//#define DEBUG_UNALIGNED
//#define DEBUG_UNASSIGNED
+//#define DEBUG_ASI
#ifdef DEBUG_MMU
#define DPRINTF_MMU(fmt, args...) \
@@ -187,7 +188,7 @@ void helper_ld_asi(int asi, int size, in
{
uint32_t ret = 0;
uint64_t tmp;
-#ifdef DEBUG_MXCC
+#if defined(DEBUG_MXCC) || defined(DEBUG_ASI)
uint32_t last_T0 = T0;
#endif
@@ -199,26 +200,34 @@ void helper_ld_asi(int asi, int size, in
ret = env->mxccregs[3];
T0 = env->mxccregs[3] >> 32;
} else
- DPRINTF_MXCC("%08x: unimplemented access size: %d\n", T0, size);
+ DPRINTF_MXCC("read %08x: unimplemented access size: %d\n", T0, size);
break;
case 0x01c00a04: /* MXCC control register */
if (size == 4)
ret = env->mxccregs[3];
else
- DPRINTF_MXCC("%08x: unimplemented access size: %d\n", T0, size);
+ DPRINTF_MXCC("read %08x: unimplemented access size: %d\n", T0, size);
+ break;
+ case 0x01c00c00: /* Module reset register */
+ if (size == 8) {
+ ret = env->mxccregs[5];
+ T0 = env->mxccregs[5] >> 32;
+ // should we do something here?
+ } else
+ DPRINTF_MXCC("read %08x: unimplemented access size: %d\n", T0, size);
break;
case 0x01c00f00: /* MBus port address register */
if (size == 8) {
ret = env->mxccregs[7];
T0 = env->mxccregs[7] >> 32;
} else
- DPRINTF_MXCC("%08x: unimplemented access size: %d\n", T0, size);
+ DPRINTF_MXCC("read %08x: unimplemented access size: %d\n", T0, size);
break;
default:
- DPRINTF_MXCC("%08x: unimplemented address, size: %d\n", T0, size);
+ DPRINTF_MXCC("read %08x: unimplemented address, size: %d\n", T0, size);
break;
}
- DPRINTF_MXCC("asi = %d, size = %d, sign = %d, T0 = %08x -> ret = %08x,"
+ DPRINTF_MXCC("read(asi %d, size %d, sign %d) T0 = %08x -> ret = %08x, "
"T0 = %08x\n", asi, size, sign, last_T0, ret, T0);
#ifdef DEBUG_MXCC
dump_mxcc(env);
@@ -355,6 +364,10 @@ void helper_ld_asi(int asi, int size, in
break;
case 0x21 ... 0x2d: /* MMU passthrough, unassigned */
default:
+#ifdef DEBUG_ASI
+ printf("read: %08x asi 0x%02x size %d unsupported address",
+ last_T0, asi, size);
+#endif
do_unassigned_access(T0, 0, 0, 1);
ret = 0;
break;
@@ -374,6 +387,11 @@ void helper_ld_asi(int asi, int size, in
}
else
T1 = ret;
+
+#ifdef DEBUG_ASI
+ printf("helper_ld_asi(asi 0x%02x, size %d, sign %d) T0 = %08x -> "
+ "T0 = %08x T1 = %08x\n", asi, size, sign, last_T0, T0, T1);
+#endif
}
void helper_st_asi(int asi, int size)
@@ -385,31 +403,31 @@ void helper_st_asi(int asi, int size)
if (size == 8)
env->mxccdata[0] = ((uint64_t)T1 << 32) | T2;
else
- DPRINTF_MXCC("%08x: unimplemented access size: %d\n", T0, size);
+ DPRINTF_MXCC("write %08x: unimplemented access size: %d\n", T0, size);
break;
case 0x01c00008: /* MXCC stream data register 1 */
if (size == 8)
env->mxccdata[1] = ((uint64_t)T1 << 32) | T2;
else
- DPRINTF_MXCC("%08x: unimplemented access size: %d\n", T0, size);
+ DPRINTF_MXCC("write %08x: unimplemented access size: %d\n", T0, size);
break;
case 0x01c00010: /* MXCC stream data register 2 */
if (size == 8)
env->mxccdata[2] = ((uint64_t)T1 << 32) | T2;
else
- DPRINTF_MXCC("%08x: unimplemented access size: %d\n", T0, size);
+ DPRINTF_MXCC("write %08x: unimplemented access size: %d\n", T0, size);
break;
case 0x01c00018: /* MXCC stream data register 3 */
if (size == 8)
env->mxccdata[3] = ((uint64_t)T1 << 32) | T2;
else
- DPRINTF_MXCC("%08x: unimplemented access size: %d\n", T0, size);
+ DPRINTF_MXCC("write %08x: unimplemented access size: %d\n", T0, size);
break;
case 0x01c00100: /* MXCC stream source */
if (size == 8)
env->mxccregs[0] = ((uint64_t)T1 << 32) | T2;
else
- DPRINTF_MXCC("%08x: unimplemented access size: %d\n", T0, size);
+ DPRINTF_MXCC("write %08x: unimplemented access size: %d\n", T0, size);
env->mxccdata[0] = ldq_phys((env->mxccregs[0] & 0xffffffffULL) + 0);
env->mxccdata[1] = ldq_phys((env->mxccregs[0] & 0xffffffffULL) + 8);
env->mxccdata[2] = ldq_phys((env->mxccregs[0] & 0xffffffffULL) + 16);
@@ -419,7 +437,7 @@ void helper_st_asi(int asi, int size)
if (size == 8)
env->mxccregs[1] = ((uint64_t)T1 << 32) | T2;
else
- DPRINTF_MXCC("%08x: unimplemented access size: %d\n", T0, size);
+ DPRINTF_MXCC("write %08x: unimplemented access size: %d\n", T0, size);
stq_phys((env->mxccregs[1] & 0xffffffffULL) + 0, env->mxccdata[0]);
stq_phys((env->mxccregs[1] & 0xffffffffULL) + 8, env->mxccdata[1]);
stq_phys((env->mxccregs[1] & 0xffffffffULL) + 16, env->mxccdata[2]);
@@ -429,34 +447,33 @@ void helper_st_asi(int asi, int size)
if (size == 8)
env->mxccregs[3] = ((uint64_t)T1 << 32) | T2;
else
- DPRINTF_MXCC("%08x: unimplemented access size: %d\n", T0, size);
+ DPRINTF_MXCC("write %08x: unimplemented access size: %d\n", T0, size);
break;
case 0x01c00a04: /* MXCC control register */
if (size == 4)
env->mxccregs[3] = (env->mxccregs[0xa] & 0xffffffff00000000) | T1;
else
- DPRINTF_MXCC("%08x: unimplemented access size: %d\n", T0, size);
+ DPRINTF_MXCC("write %08x: unimplemented access size: %d\n", T0, size);
break;
case 0x01c00e00: /* MXCC error register */
+ // writing a 1 bit clears the error
if (size == 8)
- env->mxccregs[6] = ((uint64_t)T1 << 32) | T2;
+ env->mxccregs[6] &= ~(((uint64_t)T1 << 32) | T2);
else
- DPRINTF_MXCC("%08x: unimplemented access size: %d\n", T0, size);
- if (env->mxccregs[6] == 0xffffffffffffffffULL) {
- // this is probably a reset
- }
+ DPRINTF_MXCC("write %08x: unimplemented access size: %d\n", T0, size);
break;
case 0x01c00f00: /* MBus port address register */
if (size == 8)
env->mxccregs[7] = ((uint64_t)T1 << 32) | T2;
else
- DPRINTF_MXCC("%08x: unimplemented access size: %d\n", T0, size);
+ DPRINTF_MXCC("write %08x: unimplemented access size: %d\n", T0, size);
break;
default:
- DPRINTF_MXCC("%08x: unimplemented address, size: %d\n", T0, size);
+ DPRINTF_MXCC("write %08x: unimplemented address, size: %d\n", T0, size);
break;
}
- DPRINTF_MXCC("asi = %d, size = %d, T0 = %08x, T1 = %08x\n", asi, size, T0, T1);
+ DPRINTF_MXCC("write(asi %d, size %d) T0 = %08x, T1 = %08x, T2 = %08x\n",
+ asi, size, T0, T1, T2);
#ifdef DEBUG_MXCC
dump_mxcc(env);
#endif
@@ -483,8 +500,8 @@ void helper_st_asi(int asi, int size)
#ifdef DEBUG_MMU
dump_mmu(env);
#endif
- return;
}
+ break;
case 4: /* write MMU regs */
{
int reg = (T0 >> 8) & 0xf;
@@ -515,14 +532,13 @@ void helper_st_asi(int asi, int size)
env->mmuregs[reg] = T1;
break;
}
- if (oldreg != env->mmuregs[reg]) {
+ if (oldreg != env->mmuregs[reg])
DPRINTF_MMU("mmu change reg[%d]: 0x%08x -> 0x%08x\n", reg, oldreg, env->mmuregs[reg]);
- }
#ifdef DEBUG_MMU
dump_mmu(env);
#endif
- return;
}
+ break;
case 0xa: /* User data access */
switch(size) {
case 1:
@@ -580,7 +596,7 @@ void helper_st_asi(int asi, int size)
stl_kernel(dst, temp);
}
}
- return;
+ break;
case 0x1f: /* Block fill, stda access */
{
// value (T1, T2)
@@ -595,7 +611,7 @@ void helper_st_asi(int asi, int size)
for (i = 0; i < 32; i += 8, dst += 8)
stq_kernel(dst, val);
}
- return;
+ break;
case 0x20: /* MMU passthrough */
{
switch(size) {
@@ -614,7 +630,7 @@ void helper_st_asi(int asi, int size)
break;
}
}
- return;
+ break;
case 0x2e: /* MMU passthrough, 0xexxxxxxxx */
case 0x2f: /* MMU passthrough, 0xfxxxxxxxx */
{
@@ -639,17 +655,34 @@ void helper_st_asi(int asi, int size)
break;
}
}
- return;
- case 0x31: /* Ross RT620 I-cache flush */
+ break;
+ case 0x30: /* store buffer tags */
+ case 0x31: /* store buffer date or Ross RT620 I-cache flush */
+ case 0x32: /* store buffer control */
case 0x36: /* I-cache flash clear */
case 0x37: /* D-cache flash clear */
+ case 0x38: /* MMU Breakpoint */
+ case 0x4c: /* Breakpoint action */
+#ifdef DEBUG_ASI
+ printf("write: %08x asi 0x%02x, size %d unimplemented address space\n",
+ T0, asi, size);
+#endif
break;
case 9: /* Supervisor code access, XXX */
case 0x21 ... 0x2d: /* MMU passthrough, unassigned */
default:
+#ifdef DEBUG_ASI
+ printf("write: %08x asi 0x%02x, size %d unsupported address space\n",
+ T0, asi, size);
+#endif
do_unassigned_access(T0, 1, 0, 1);
- return;
+ break;
}
+
+#ifdef DEBUG_ASI
+ printf("helper_st_asi(asi 0x%02x, size %d) T0 = %08x T1 = %08x T2 = %08x\n",
+ asi, size, T0, T1, T2);
+#endif
}
#endif /* CONFIG_USER_ONLY */
next reply other threads:[~2007-11-10 18:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-10 18:28 Robert Reif [this message]
2007-11-10 21:09 ` [Qemu-devel] [PATCH] sparc32 asi cleanups and debug printf Blue Swirl
2007-11-10 21:27 ` Robert Reif
2007-11-15 19:33 ` Blue Swirl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4735F83F.6020607@earthlink.net \
--to=reif@earthlink.net \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.