Re: [Qemu-devel] [PATCH] sparc32 asi cleanups and debug printf
On 11/10/07, Robert Reif <[EMAIL PROTECTED]> wrote: > Blue Swirl wrote: > > >DPRINTF_ASI would be nice. > > > > > > > Here is a revised patch: Thanks. The patch didn't apply completely. I noticed that there are some too long lines, they should be wrapped. Module reset register should be in a different patch. Cache ASIs are implemented, they just do nothing, so the debug text should only apply to the store buffer (but not Ross I-cache flush?) and breakpoint ASIs. This by the way highlights that there should be a mechanism to register CPU specific ASIs and their handlers so that these ASI conflicts can be resolved. Because on Sparc32 we know the ASI at translation time, the handler can be selected then to get a small speedup.
Re: [Qemu-devel] [PATCH] sparc32 asi cleanups and debug printf
Blue Swirl wrote: DPRINTF_ASI would be nice. Here is a revised patch: 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.c7 Nov 2007 17:03:37 - 1.51 +++ target-sparc/op_helper.c10 Nov 2007 21:24:04 - @@ -6,6 +6,7 @@ //#define DEBUG_MXCC //#define DEBUG_UNALIGNED //#define DEBUG_UNASSIGNED +//#define DEBUG_ASI #ifdef DEBUG_MMU #define DPRINTF_MMU(fmt, args...) \ @@ -21,6 +22,13 @@ do { printf("MXCC: " fmt , ##args); } wh #define DPRINTF_MXCC(fmt, args...) #endif +#ifdef DEBUG_ASI +#define DPRINTF_ASI(fmt, args...) \ +do { printf("ASI: " fmt , ##args); } while (0) +#else +#define DPRINTF_ASI(fmt, args...) +#endif + void raise_exception(int tt) { env->exception_index = tt; @@ -187,7 +195,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 +207,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 +371,8 @@ void helper_ld_asi(int asi, int size, in break; case 0x21 ... 0x2d: /* MMU passthrough, unassigned */ default: +DPRINTF_ASI("read: %08x asi 0x%02x size %d unsupported address", + last_T0, asi, size); do_unassigned_access(T0, 0, 0, 1); ret = 0; break; @@ -374,6 +392,9 @@ void helper_ld_asi(int asi, int size, in } else T1 = ret; + +DPRINTF_ASI("helper_ld_asi(asi 0x%02x, size %d, sign %d) T0 = %08x -> " + "T0 = %08x T1 = %08x\n", asi, size, sign, last_T0, T0, T1); } void helper_st_asi(int asi, int size) @@ -385,31 +406,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 0x01c8: /* 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"
Re: [Qemu-devel] [PATCH] sparc32 asi cleanups and debug printf
On 11/10/07, Robert Reif <[EMAIL PROTECTED]> wrote: > This patch makes debugging asi and mxcc accesses easier to follow. ... and adds a new register. DPRINTF_ASI would be nice.
[Qemu-devel] [PATCH] sparc32 asi cleanups and debug printf
This patch makes debugging asi and mxcc accesses easier to follow. 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.c7 Nov 2007 17:03:37 - 1.51 +++ target-sparc/op_helper.c10 Nov 2007 18:22:34 - @@ -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 0x01c8: /* 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 -