提交 eaed129d 编写于 作者: P Peter Maydell

target-arm: Pass DisasContext* to gen_set_pc_im()

We want gen_set_pc_im() to work for both AArch64 and AArch32, but
to do this we'll need the DisasContext* so we can tell which mode
we're in, so pass it in as a parameter.
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
Message-id: 1378235544-22290-7-git-send-email-peter.maydell@linaro.org
上级 0a2461fa
...@@ -905,7 +905,7 @@ DO_GEN_ST(st8) ...@@ -905,7 +905,7 @@ DO_GEN_ST(st8)
DO_GEN_ST(st16) DO_GEN_ST(st16)
DO_GEN_ST(st32) DO_GEN_ST(st32)
static inline void gen_set_pc_im(target_ulong val) static inline void gen_set_pc_im(DisasContext *s, target_ulong val)
{ {
tcg_gen_movi_i32(cpu_R[15], val); tcg_gen_movi_i32(cpu_R[15], val);
} }
...@@ -3420,10 +3420,10 @@ static inline void gen_goto_tb(DisasContext *s, int n, target_ulong dest) ...@@ -3420,10 +3420,10 @@ static inline void gen_goto_tb(DisasContext *s, int n, target_ulong dest)
tb = s->tb; tb = s->tb;
if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) { if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)) {
tcg_gen_goto_tb(n); tcg_gen_goto_tb(n);
gen_set_pc_im(dest); gen_set_pc_im(s, dest);
tcg_gen_exit_tb((uintptr_t)tb + n); tcg_gen_exit_tb((uintptr_t)tb + n);
} else { } else {
gen_set_pc_im(dest); gen_set_pc_im(s, dest);
tcg_gen_exit_tb(0); tcg_gen_exit_tb(0);
} }
} }
...@@ -3552,7 +3552,7 @@ gen_set_condexec (DisasContext *s) ...@@ -3552,7 +3552,7 @@ gen_set_condexec (DisasContext *s)
static void gen_exception_insn(DisasContext *s, int offset, int excp) static void gen_exception_insn(DisasContext *s, int offset, int excp)
{ {
gen_set_condexec(s); gen_set_condexec(s);
gen_set_pc_im(s->pc - offset); gen_set_pc_im(s, s->pc - offset);
gen_exception(excp); gen_exception(excp);
s->is_jmp = DISAS_JUMP; s->is_jmp = DISAS_JUMP;
} }
...@@ -3561,7 +3561,7 @@ static void gen_nop_hint(DisasContext *s, int val) ...@@ -3561,7 +3561,7 @@ static void gen_nop_hint(DisasContext *s, int val)
{ {
switch (val) { switch (val) {
case 3: /* wfi */ case 3: /* wfi */
gen_set_pc_im(s->pc); gen_set_pc_im(s, s->pc);
s->is_jmp = DISAS_WFI; s->is_jmp = DISAS_WFI;
break; break;
case 2: /* wfe */ case 2: /* wfe */
...@@ -6338,7 +6338,7 @@ static int disas_coproc_insn(CPUARMState * env, DisasContext *s, uint32_t insn) ...@@ -6338,7 +6338,7 @@ static int disas_coproc_insn(CPUARMState * env, DisasContext *s, uint32_t insn)
if (isread) { if (isread) {
return 1; return 1;
} }
gen_set_pc_im(s->pc); gen_set_pc_im(s, s->pc);
s->is_jmp = DISAS_WFI; s->is_jmp = DISAS_WFI;
return 0; return 0;
default: default:
...@@ -6358,7 +6358,7 @@ static int disas_coproc_insn(CPUARMState * env, DisasContext *s, uint32_t insn) ...@@ -6358,7 +6358,7 @@ static int disas_coproc_insn(CPUARMState * env, DisasContext *s, uint32_t insn)
tmp64 = tcg_const_i64(ri->resetvalue); tmp64 = tcg_const_i64(ri->resetvalue);
} else if (ri->readfn) { } else if (ri->readfn) {
TCGv_ptr tmpptr; TCGv_ptr tmpptr;
gen_set_pc_im(s->pc); gen_set_pc_im(s, s->pc);
tmp64 = tcg_temp_new_i64(); tmp64 = tcg_temp_new_i64();
tmpptr = tcg_const_ptr(ri); tmpptr = tcg_const_ptr(ri);
gen_helper_get_cp_reg64(tmp64, cpu_env, tmpptr); gen_helper_get_cp_reg64(tmp64, cpu_env, tmpptr);
...@@ -6381,7 +6381,7 @@ static int disas_coproc_insn(CPUARMState * env, DisasContext *s, uint32_t insn) ...@@ -6381,7 +6381,7 @@ static int disas_coproc_insn(CPUARMState * env, DisasContext *s, uint32_t insn)
tmp = tcg_const_i32(ri->resetvalue); tmp = tcg_const_i32(ri->resetvalue);
} else if (ri->readfn) { } else if (ri->readfn) {
TCGv_ptr tmpptr; TCGv_ptr tmpptr;
gen_set_pc_im(s->pc); gen_set_pc_im(s, s->pc);
tmp = tcg_temp_new_i32(); tmp = tcg_temp_new_i32();
tmpptr = tcg_const_ptr(ri); tmpptr = tcg_const_ptr(ri);
gen_helper_get_cp_reg(tmp, cpu_env, tmpptr); gen_helper_get_cp_reg(tmp, cpu_env, tmpptr);
...@@ -6416,7 +6416,7 @@ static int disas_coproc_insn(CPUARMState * env, DisasContext *s, uint32_t insn) ...@@ -6416,7 +6416,7 @@ static int disas_coproc_insn(CPUARMState * env, DisasContext *s, uint32_t insn)
tcg_temp_free_i32(tmphi); tcg_temp_free_i32(tmphi);
if (ri->writefn) { if (ri->writefn) {
TCGv_ptr tmpptr = tcg_const_ptr(ri); TCGv_ptr tmpptr = tcg_const_ptr(ri);
gen_set_pc_im(s->pc); gen_set_pc_im(s, s->pc);
gen_helper_set_cp_reg64(cpu_env, tmpptr, tmp64); gen_helper_set_cp_reg64(cpu_env, tmpptr, tmp64);
tcg_temp_free_ptr(tmpptr); tcg_temp_free_ptr(tmpptr);
} else { } else {
...@@ -6427,7 +6427,7 @@ static int disas_coproc_insn(CPUARMState * env, DisasContext *s, uint32_t insn) ...@@ -6427,7 +6427,7 @@ static int disas_coproc_insn(CPUARMState * env, DisasContext *s, uint32_t insn)
if (ri->writefn) { if (ri->writefn) {
TCGv_i32 tmp; TCGv_i32 tmp;
TCGv_ptr tmpptr; TCGv_ptr tmpptr;
gen_set_pc_im(s->pc); gen_set_pc_im(s, s->pc);
tmp = load_reg(s, rt); tmp = load_reg(s, rt);
tmpptr = tcg_const_ptr(ri); tmpptr = tcg_const_ptr(ri);
gen_helper_set_cp_reg(cpu_env, tmpptr, tmp); gen_helper_set_cp_reg(cpu_env, tmpptr, tmp);
...@@ -8036,7 +8036,7 @@ static void disas_arm_insn(CPUARMState * env, DisasContext *s) ...@@ -8036,7 +8036,7 @@ static void disas_arm_insn(CPUARMState * env, DisasContext *s)
break; break;
case 0xf: case 0xf:
/* swi */ /* swi */
gen_set_pc_im(s->pc); gen_set_pc_im(s, s->pc);
s->is_jmp = DISAS_SWI; s->is_jmp = DISAS_SWI;
break; break;
default: default:
...@@ -9940,7 +9940,7 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s) ...@@ -9940,7 +9940,7 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s)
if (cond == 0xf) { if (cond == 0xf) {
/* swi */ /* swi */
gen_set_pc_im(s->pc); gen_set_pc_im(s, s->pc);
s->is_jmp = DISAS_SWI; s->is_jmp = DISAS_SWI;
break; break;
} }
...@@ -10190,7 +10190,7 @@ static inline void gen_intermediate_code_internal(ARMCPU *cpu, ...@@ -10190,7 +10190,7 @@ static inline void gen_intermediate_code_internal(ARMCPU *cpu,
gen_set_label(dc->condlabel); gen_set_label(dc->condlabel);
} }
if (dc->condjmp || !dc->is_jmp) { if (dc->condjmp || !dc->is_jmp) {
gen_set_pc_im(dc->pc); gen_set_pc_im(dc, dc->pc);
dc->condjmp = 0; dc->condjmp = 0;
} }
gen_set_condexec(dc); gen_set_condexec(dc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册