aboutsummaryrefslogtreecommitdiffstats
path: root/target-arm
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2009-10-15 18:18:09 -0700
committerDavid 'Digit' Turner <digit@google.com>2009-10-15 18:18:09 -0700
commita577fcadc0b365ee629aec313f57a65d54fe5d89 (patch)
tree2a4d76772b9f6169a06fa4e685b6d6dd50957ac4 /target-arm
parent73b9926fd43c9b5cd00319c5d117448bd1b31112 (diff)
downloadexternal_qemu-a577fcadc0b365ee629aec313f57a65d54fe5d89.zip
external_qemu-a577fcadc0b365ee629aec313f57a65d54fe5d89.tar.gz
external_qemu-a577fcadc0b365ee629aec313f57a65d54fe5d89.tar.bz2
Fix the -trace emulator option.
A critical test in the execution loop was missed in the latest huge integration. Also optimize slightly the basic-block start recording helper interface.
Diffstat (limited to 'target-arm')
-rw-r--r--target-arm/helper.c3
-rw-r--r--target-arm/helpers.h2
-rw-r--r--target-arm/translate.c66
3 files changed, 50 insertions, 21 deletions
diff --git a/target-arm/helper.c b/target-arm/helper.c
index a225224..9ac7e25 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -2644,9 +2644,8 @@ void HELPER(traceInsn)(void)
}
#if HOST_LONG_BITS == 32
-void HELPER(traceBB32)(uint32_t hi, uint32_t lo, uint32_t tb)
+void HELPER(traceBB32)(uint64_t bb_num, uint32_t tb)
{
- uint64_t bb_num = ((uint64_t)hi << 32) | lo;
trace_bb_helper(bb_num, (void*)tb);
}
#endif
diff --git a/target-arm/helpers.h b/target-arm/helpers.h
index 1a6790e..abc54d2 100644
--- a/target-arm/helpers.h
+++ b/target-arm/helpers.h
@@ -19,7 +19,7 @@ DEF_HELPER_1(abs, i32, i32)
DEF_HELPER_1(traceTicks, void, i32)
DEF_HELPER_0(traceInsn, void)
#if HOST_LONG_BITS == 32
-DEF_HELPER_3(traceBB32, void, i32, i32, i32)
+DEF_HELPER_2(traceBB32, void, i64, i32)
#endif
#if HOST_LONG_BITS == 64
DEF_HELPER_2(traceBB64, void, i64, i64)
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 45dd237..b6e1a34 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -75,15 +75,6 @@ typedef struct DisasContext {
#ifdef CONFIG_TRACE
#include "helpers.h"
-#if HOST_LONG_BITS == 32
-# define gen_helper_traceBB(num,tb) \
- gen_helper_traceBB32((uint32_t)((num) >> 32), (uint32_t)(num), (tb))
-#elif HOST_LONG_BITS == 64
-# define gen_helper_traceBB gen_helper_traceBB64
-#else
-# error Unsupported HOST_LONG_BITS value
-#endif
-#
#endif /* CONFIG_TRACE */
/* These instructions trap after executing, so defer them until after the
@@ -5742,6 +5733,45 @@ static void gen_logicq_cc(TCGv_i64 val)
dead_tmp(tmp);
}
+
+#ifdef CONFIG_TRACE
+
+#define gen_traceInsn() gen_helper_traceInsn()
+
+static void
+gen_traceTicks( int count )
+{
+ TCGv tmp = tcg_temp_new_i32();
+ tcg_gen_movi_i32(tmp, count);
+ gen_helper_traceTicks(tmp);
+ tcg_temp_free_i32(tmp);
+}
+
+static void
+gen_traceBB( uint64_t bbNum, target_phys_addr_t tb )
+{
+#if HOST_LONG_BITS == 32
+ TCGv_i64 tmpNum = tcg_temp_new_i64();
+ TCGv_i32 tmpTb = tcg_temp_new_i32();
+
+ tcg_gen_movi_i64(tmpNum, (int64_t)bbNum);
+ tcg_gen_movi_i32(tmpTb, (int32_t)tb);
+ gen_helper_traceBB32(tmpNum, tmpTb);
+ tcg_temp_free_i32(tmpTb);
+ tcg_temp_free_i64(tmpNum);
+#elif HOST_LONG_BITS == 64
+ TCGv_i64 tmpNum = tcg_temp_new_i64();
+ TCGv_i64 tmpTb = tcg_temp_new_i32();
+
+ tcg_gen_movi_i64(tmpNum, (int64_t)bbNum);
+ tcg_gen_movi_i64(tmpTb, (int64_t)tb);
+ gen_helper_traceBB32(tmpNum, tmpTb);
+ tcg_temp_free_i64(tmpTb);
+ tcg_temp_free_i64(tmpNum);
+#endif
+}
+#endif /* CONFIG_TRACE */
+
static void disas_arm_insn(CPUState * env, DisasContext *s)
{
unsigned int cond, insn, val, op1, i, shift, rm, rs, rn, rd, sh;
@@ -5759,7 +5789,7 @@ static void disas_arm_insn(CPUState * env, DisasContext *s)
if (tracing) {
trace_add_insn(insn, 0);
ticks = get_insn_ticks_arm(insn);
- gen_helper_traceInsn();
+ gen_traceInsn();
}
#endif
s->pc += 4;
@@ -5771,7 +5801,7 @@ static void disas_arm_insn(CPUState * env, DisasContext *s)
if (cond == 0xf){
#ifdef CONFIG_TRACE
if (tracing) {
- gen_helper_traceTicks(ticks);
+ gen_traceTicks(ticks);
}
#endif
/* Unconditional instructions. */
@@ -5965,7 +5995,7 @@ static void disas_arm_insn(CPUState * env, DisasContext *s)
if (tracing) {
/* a non-executed conditional instruction takes */
/* only 1 cycle */
- gen_helper_traceTicks(1);
+ gen_traceTicks(1);
ticks -= 1;
}
#endif
@@ -5977,7 +6007,7 @@ static void disas_arm_insn(CPUState * env, DisasContext *s)
}
#ifdef CONFIG_TRACE
if (tracing && ticks > 0) {
- gen_helper_traceTicks(ticks);
+ gen_traceTicks(ticks);
}
#endif
if ((insn & 0x0f900000) == 0x03000000) {
@@ -7136,8 +7166,8 @@ static int disas_thumb2_insn(CPUState *env, DisasContext *s, uint16_t insn_hw1)
if (tracing) {
int ticks = get_insn_ticks_thumb(insn);
trace_add_insn( insn_wrap_thumb(insn), 1 );
- gen_helper_traceInsn();
- gen_helper_traceTicks(ticks);
+ gen_traceInsn();
+ gen_traceTicks(ticks);
}
#endif
s->pc += 2;
@@ -8123,8 +8153,8 @@ static void disas_thumb_insn(CPUState *env, DisasContext *s)
if (tracing) {
int ticks = get_insn_ticks_thumb(insn);
trace_add_insn( insn_wrap_thumb(insn), 1 );
- gen_helper_traceInsn();
- gen_helper_traceTicks(ticks);
+ gen_traceInsn();
+ gen_traceTicks(ticks);
}
#endif
s->pc += 2;
@@ -8822,7 +8852,7 @@ static inline void gen_intermediate_code_internal(CPUState *env,
gen_icount_start();
#ifdef CONFIG_TRACE
if (tracing) {
- gen_helper_traceBB(trace_static.bb_num, (target_phys_addr_t)tb );
+ gen_traceBB(trace_static.bb_num, (target_phys_addr_t)tb );
trace_bb_start(dc->pc);
}
#endif