* [Qemu-devel] [PATCH 0/2] clean up cpu_dump_state flags
@ 2012-08-07 13:51 Peter Maydell
2012-08-07 13:51 ` [Qemu-devel] [PATCH 1/2] cpu_dump_state: move DUMP_FPU and DUMP_CCOP flags from x86-only to generic Peter Maydell
2012-08-07 13:51 ` [Qemu-devel] [PATCH 2/2] target-arm: Reinstate display of VFP registers in cpu_dump_state Peter Maydell
0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2012-08-07 13:51 UTC (permalink / raw)
To: qemu-devel; +Cc: patches
This is a small cleanup patchset which moves some cpu_dump_state
flags from being x86 only to being generic, since the extra info
they ask for is not particularly x86 specific (many of our
target architectures have an fpu, and similarly several implement
the TCG condition-code optimisation). This allows us to remove
some ugly TARGET_I386 ifdefs from target-independent code.
I've also implemented the DUMP_FPU flag for ARM, by reinstating
(somewhat modified) some code which had been #if'd out for years.
There should be no behaviour change for other architectures.
Peter Maydell (2):
cpu_dump_state: move DUMP_FPU and DUMP_CCOP flags from x86-only to
generic
target-arm: Reinstate display of VFP registers in cpu_dump_state
cpu-all.h | 3 +++
cpu-exec.c | 2 +-
cpus.c | 6 +-----
exec.c | 12 ++----------
monitor.c | 8 +-------
target-arm/translate.c | 42 ++++++++++++++++--------------------------
target-i386/cpu.c | 2 +-
target-i386/cpu.h | 4 ----
target-i386/helper.c | 4 ++--
target-i386/seg_helper.c | 4 ++--
target-i386/smm_helper.c | 4 ++--
11 files changed, 31 insertions(+), 60 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH 1/2] cpu_dump_state: move DUMP_FPU and DUMP_CCOP flags from x86-only to generic
2012-08-07 13:51 [Qemu-devel] [PATCH 0/2] clean up cpu_dump_state flags Peter Maydell
@ 2012-08-07 13:51 ` Peter Maydell
2012-08-07 13:51 ` [Qemu-devel] [PATCH 2/2] target-arm: Reinstate display of VFP registers in cpu_dump_state Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2012-08-07 13:51 UTC (permalink / raw)
To: qemu-devel; +Cc: patches
Move the DUMP_FPU and DUMP_CCOP flags for cpu_dump_state() from being
x86-specific flags to being generic ones. This allows us to drop some
TARGET_I386 ifdefs in various places, and means that we can (potentially)
be more consistent across architectures about which monitor commands or
debug abort printouts include FPU register contents and info about
QEMU's condition-code optimisations.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
cpu-all.h | 3 +++
cpu-exec.c | 2 +-
cpus.c | 6 +-----
exec.c | 12 ++----------
monitor.c | 8 +-------
target-i386/cpu.c | 2 +-
target-i386/cpu.h | 4 ----
target-i386/helper.c | 4 ++--
target-i386/seg_helper.c | 4 ++--
target-i386/smm_helper.c | 4 ++--
10 files changed, 15 insertions(+), 34 deletions(-)
diff --git a/cpu-all.h b/cpu-all.h
index 82ba1d7..19cc34d 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -345,6 +345,9 @@ CPUArchState *cpu_copy(CPUArchState *env);
CPUArchState *qemu_get_cpu(int cpu);
#define CPU_DUMP_CODE 0x00010000
+#define CPU_DUMP_FPU 0x00020000 /* dump FPU register state, not just integer */
+/* dump info about TCG QEMU's condition code optimization state */
+#define CPU_DUMP_CCOP 0x00040000
void cpu_dump_state(CPUArchState *env, FILE *f, fprintf_function cpu_fprintf,
int flags);
diff --git a/cpu-exec.c b/cpu-exec.c
index 543460c..58ded3e 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -554,7 +554,7 @@ int cpu_exec(CPUArchState *env)
#if defined(TARGET_I386)
env->eflags = env->eflags | cpu_cc_compute_all(env, CC_OP)
| (DF & DF_MASK);
- log_cpu_state(env, X86_DUMP_CCOP);
+ log_cpu_state(env, CPU_DUMP_CCOP);
env->eflags &= ~(DF_MASK | CC_O | CC_S | CC_Z | CC_A | CC_P | CC_C);
#elif defined(TARGET_M68K)
cpu_m68k_flush_flags(env, env->cc_op);
diff --git a/cpus.c b/cpus.c
index 3de2e27..1760101 100644
--- a/cpus.c
+++ b/cpus.c
@@ -394,11 +394,7 @@ void hw_error(const char *fmt, ...)
fprintf(stderr, "\n");
for(env = first_cpu; env != NULL; env = env->next_cpu) {
fprintf(stderr, "CPU #%d:\n", env->cpu_index);
-#ifdef TARGET_I386
- cpu_dump_state(env, stderr, fprintf, X86_DUMP_FPU);
-#else
- cpu_dump_state(env, stderr, fprintf, 0);
-#endif
+ cpu_dump_state(env, stderr, fprintf, CPU_DUMP_FPU);
}
va_end(ap);
abort();
diff --git a/exec.c b/exec.c
index a42a0b5..bde2bbf 100644
--- a/exec.c
+++ b/exec.c
@@ -1744,20 +1744,12 @@ void cpu_abort(CPUArchState *env, const char *fmt, ...)
fprintf(stderr, "qemu: fatal: ");
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
-#ifdef TARGET_I386
- cpu_dump_state(env, stderr, fprintf, X86_DUMP_FPU | X86_DUMP_CCOP);
-#else
- cpu_dump_state(env, stderr, fprintf, 0);
-#endif
+ cpu_dump_state(env, stderr, fprintf, CPU_DUMP_FPU | CPU_DUMP_CCOP);
if (qemu_log_enabled()) {
qemu_log("qemu: fatal: ");
qemu_log_vprintf(fmt, ap2);
qemu_log("\n");
-#ifdef TARGET_I386
- log_cpu_state(env, X86_DUMP_FPU | X86_DUMP_CCOP);
-#else
- log_cpu_state(env, 0);
-#endif
+ log_cpu_state(env, CPU_DUMP_FPU | CPU_DUMP_CCOP);
qemu_log_flush();
qemu_log_close();
}
diff --git a/monitor.c b/monitor.c
index 49dccfe..2ea78c4 100644
--- a/monitor.c
+++ b/monitor.c
@@ -899,13 +899,7 @@ static void do_info_registers(Monitor *mon)
{
CPUArchState *env;
env = mon_get_cpu();
-#ifdef TARGET_I386
- cpu_dump_state(env, (FILE *)mon, monitor_fprintf,
- X86_DUMP_FPU);
-#else
- cpu_dump_state(env, (FILE *)mon, monitor_fprintf,
- 0);
-#endif
+ cpu_dump_state(env, (FILE *)mon, monitor_fprintf, CPU_DUMP_FPU);
}
static void do_info_jit(Monitor *mon)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 857b94e..60e152a 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1618,7 +1618,7 @@ static void x86_cpu_reset(CPUState *s)
if (qemu_loglevel_mask(CPU_LOG_RESET)) {
qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
- log_cpu_state(env, X86_DUMP_FPU | X86_DUMP_CCOP);
+ log_cpu_state(env, CPU_DUMP_FPU | CPU_DUMP_CCOP);
}
xcc->parent_reset(s);
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 2a61c81..a650000 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -945,10 +945,6 @@ void cpu_x86_update_cr4(CPUX86State *env, uint32_t new_cr4);
void cpu_smm_update(CPUX86State *env);
uint64_t cpu_get_tsc(CPUX86State *env);
-/* used to debug */
-#define X86_DUMP_FPU 0x0001 /* dump FPU state too */
-#define X86_DUMP_CCOP 0x0002 /* dump qemu flag cache */
-
#define TARGET_PAGE_BITS 12
#ifdef TARGET_X86_64
diff --git a/target-i386/helper.c b/target-i386/helper.c
index b748d90..7564816 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -284,7 +284,7 @@ void cpu_dump_state(CPUX86State *env, FILE *f, fprintf_function cpu_fprintf,
cpu_fprintf(f, "\nDR6=" TARGET_FMT_lx " DR7=" TARGET_FMT_lx "\n",
env->dr[6], env->dr[7]);
}
- if (flags & X86_DUMP_CCOP) {
+ if (flags & CPU_DUMP_CCOP) {
if ((unsigned)env->cc_op < CC_OP_NB)
snprintf(cc_op_name, sizeof(cc_op_name), "%s", cc_op_str[env->cc_op]);
else
@@ -303,7 +303,7 @@ void cpu_dump_state(CPUX86State *env, FILE *f, fprintf_function cpu_fprintf,
}
}
cpu_fprintf(f, "EFER=%016" PRIx64 "\n", env->efer);
- if (flags & X86_DUMP_FPU) {
+ if (flags & CPU_DUMP_FPU) {
int fptag;
fptag = 0;
for(i = 0; i < 8; i++) {
diff --git a/target-i386/seg_helper.c b/target-i386/seg_helper.c
index a4b8b64..032be1a 100644
--- a/target-i386/seg_helper.c
+++ b/target-i386/seg_helper.c
@@ -32,7 +32,7 @@
#ifdef DEBUG_PCALL
# define LOG_PCALL(...) qemu_log_mask(CPU_LOG_PCALL, ## __VA_ARGS__)
# define LOG_PCALL_STATE(env) \
- log_cpu_state_mask(CPU_LOG_PCALL, (env), X86_DUMP_CCOP)
+ log_cpu_state_mask(CPU_LOG_PCALL, (env), CPU_DUMP_CCOP)
#else
# define LOG_PCALL(...) do { } while (0)
# define LOG_PCALL_STATE(env) do { } while (0)
@@ -1174,7 +1174,7 @@ static void do_interrupt_all(int intno, int is_int, int error_code,
qemu_log(" EAX=" TARGET_FMT_lx, EAX);
}
qemu_log("\n");
- log_cpu_state(env, X86_DUMP_CCOP);
+ log_cpu_state(env, CPU_DUMP_CCOP);
#if 0
{
int i;
diff --git a/target-i386/smm_helper.c b/target-i386/smm_helper.c
index bc1bfa2..7ed9cc4 100644
--- a/target-i386/smm_helper.c
+++ b/target-i386/smm_helper.c
@@ -52,7 +52,7 @@ void do_smm_enter(CPUX86State *env1)
env = env1;
qemu_log_mask(CPU_LOG_INT, "SMM: enter\n");
- log_cpu_state_mask(CPU_LOG_INT, env, X86_DUMP_CCOP);
+ log_cpu_state_mask(CPU_LOG_INT, env, CPU_DUMP_CCOP);
env->hflags |= HF_SMM_MASK;
cpu_smm_update(env);
@@ -301,7 +301,7 @@ void helper_rsm(void)
cpu_smm_update(env);
qemu_log_mask(CPU_LOG_INT, "SMM: after RSM\n");
- log_cpu_state_mask(CPU_LOG_INT, env, X86_DUMP_CCOP);
+ log_cpu_state_mask(CPU_LOG_INT, env, CPU_DUMP_CCOP);
}
#endif /* !CONFIG_USER_ONLY */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH 2/2] target-arm: Reinstate display of VFP registers in cpu_dump_state
2012-08-07 13:51 [Qemu-devel] [PATCH 0/2] clean up cpu_dump_state flags Peter Maydell
2012-08-07 13:51 ` [Qemu-devel] [PATCH 1/2] cpu_dump_state: move DUMP_FPU and DUMP_CCOP flags from x86-only to generic Peter Maydell
@ 2012-08-07 13:51 ` Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2012-08-07 13:51 UTC (permalink / raw)
To: qemu-devel; +Cc: patches
Reinstate the display of VFP registers in cpu_dump_state(), if
the CPU has them (this code had been #if 0'd out a for a long time).
We drop the attempt ot display the values as floating point, since
this makes assumptions about the host 'float' and 'double' formats
and is not done by eg the i386 cpu_dump_state().
This display is gated on the CPU_DUMP_FPU flag, as for x86.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target-arm/translate.c | 42 ++++++++++++++++--------------------------
1 file changed, 16 insertions(+), 26 deletions(-)
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 29008a4..1ada5fc 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -9970,19 +9970,6 @@ void cpu_dump_state(CPUARMState *env, FILE *f, fprintf_function cpu_fprintf,
int flags)
{
int i;
-#if 0
- union {
- uint32_t i;
- float s;
- } s0, s1;
- CPU_DoubleU d;
- /* ??? This assumes float64 and double have the same layout.
- Oh well, it's only debug dumps. */
- union {
- float64 f64;
- double d;
- } d0;
-#endif
uint32_t psr;
for(i=0;i<16;i++) {
@@ -10002,20 +9989,23 @@ void cpu_dump_state(CPUARMState *env, FILE *f, fprintf_function cpu_fprintf,
psr & CPSR_T ? 'T' : 'A',
cpu_mode_names[psr & 0xf], (psr & 0x10) ? 32 : 26);
-#if 0
- for (i = 0; i < 16; i++) {
- d.d = env->vfp.regs[i];
- s0.i = d.l.lower;
- s1.i = d.l.upper;
- d0.f64 = d.d;
- cpu_fprintf(f, "s%02d=%08x(%8g) s%02d=%08x(%8g) d%02d=%08x%08x(%8g)\n",
- i * 2, (int)s0.i, s0.s,
- i * 2 + 1, (int)s1.i, s1.s,
- i, (int)(uint32_t)d.l.upper, (int)(uint32_t)d.l.lower,
- d0.d);
+ if (flags & CPU_DUMP_FPU) {
+ int numvfpregs = 0;
+ if (arm_feature(env, ARM_FEATURE_VFP)) {
+ numvfpregs += 16;
+ }
+ if (arm_feature(env, ARM_FEATURE_VFP3)) {
+ numvfpregs += 16;
+ }
+ for (i = 0; i < numvfpregs; i++) {
+ uint64_t v = float64_val(env->vfp.regs[i]);
+ cpu_fprintf(f, "s%02d=%08x s%02d=%08x d%02d=%016" PRIx64 "\n",
+ i * 2, (uint32_t)v,
+ i * 2 + 1, (uint32_t)(v >> 32),
+ i, v);
+ }
+ cpu_fprintf(f, "FPSCR: %08x\n", (int)env->vfp.xregs[ARM_VFP_FPSCR]);
}
- cpu_fprintf(f, "FPSCR: %08x\n", (int)env->vfp.xregs[ARM_VFP_FPSCR]);
-#endif
}
void restore_state_to_opc(CPUARMState *env, TranslationBlock *tb, int pc_pos)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-08-07 13:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-07 13:51 [Qemu-devel] [PATCH 0/2] clean up cpu_dump_state flags Peter Maydell
2012-08-07 13:51 ` [Qemu-devel] [PATCH 1/2] cpu_dump_state: move DUMP_FPU and DUMP_CCOP flags from x86-only to generic Peter Maydell
2012-08-07 13:51 ` [Qemu-devel] [PATCH 2/2] target-arm: Reinstate display of VFP registers in cpu_dump_state Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).