Signed-off-by: Michael Rolnik <mrol...@gmail.com> --- target-arc/helper.h | 1 + target-arc/op_helper.c | 6 +++++ target-arc/translate-inst.c | 61 +++++++++++++++++++++++++++++++++++++++++++++ target-arc/translate-inst.h | 4 +++ 4 files changed, 72 insertions(+)
diff --git a/target-arc/helper.h b/target-arc/helper.h index 1d84935..14769b1 100644 --- a/target-arc/helper.h +++ b/target-arc/helper.h @@ -23,4 +23,5 @@ DEF_HELPER_2(norm, i32, env, i32) DEF_HELPER_2(normw, i32, env, i32) DEF_HELPER_2(lr, tl, env, i32) DEF_HELPER_2(sr, void, i32, i32) +DEF_HELPER_1(halt, void, env) diff --git a/target-arc/op_helper.c b/target-arc/op_helper.c index 3cf9080..b07939c 100644 --- a/target-arc/op_helper.c +++ b/target-arc/op_helper.c @@ -411,3 +411,9 @@ target_ulong helper_lr(CPUARCState *env, uint32_t aux) return result; } +void helper_halt(CPUARCState *env) +{ + /* TODO: implement */ +} + + diff --git a/target-arc/translate-inst.c b/target-arc/translate-inst.c index 524b213..9d0f195 100644 --- a/target-arc/translate-inst.c +++ b/target-arc/translate-inst.c @@ -2617,3 +2617,64 @@ gen_set_label(label_done); return BS_NONE; } +/* + BRK +*/ +int arc_gen_BRK(DisasCtxt *ctx) +{ + tcg_gen_movi_tl(cpu_debug_BH, 1); + gen_helper_halt(cpu_env); + return BS_BREAK; +} + +/* + FLAG +*/ +int arc_gen_FLAG(DisasCtxt *ctx, TCGv src1) +{ + TCGLabel *label_else = gen_new_label(); + TCGLabel *label_done = gen_new_label(); + TCGv temp = tcg_temp_new_i32(); + + tcg_gen_mov_tl(temp, src1); + + tcg_gen_andi_tl(cpu_Hf, temp, 1); + tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_Hf, 0, label_else); + + gen_helper_halt(cpu_env); + +gen_set_label(label_else); + tcg_gen_shri_tl(temp, temp, 1); + tcg_gen_andi_tl(cpu_E1f, temp, 1); + + tcg_gen_shri_tl(temp, temp, 1); + tcg_gen_andi_tl(cpu_E2f, temp, 1); + + tcg_gen_shri_tl(temp, temp, 6); + tcg_gen_andi_tl(cpu_Vf, temp, 1); + + tcg_gen_shri_tl(temp, temp, 1); + tcg_gen_andi_tl(cpu_Cf, temp, 1); + + tcg_gen_shri_tl(temp, temp, 1); + tcg_gen_andi_tl(cpu_Nf, temp, 1); + + tcg_gen_shri_tl(temp, temp, 1); + tcg_gen_andi_tl(cpu_Zf, temp, 1); +gen_set_label(label_done); + + return BS_NONE; +} + +/* + SLEEP +*/ +int arc_gen_SLEEP(DisasCtxt *ctx, TCGv src1) +{ + tcg_gen_movi_tl(cpu_debug_ZZ, 1); + tcg_gen_andi_tl(cpu_E1f, src1, 0x01); + tcg_gen_andi_tl(cpu_E2f, src1, 0x02); + + return BS_BREAK; +} + diff --git a/target-arc/translate-inst.h b/target-arc/translate-inst.h index e2b76d4..5794cad 100644 --- a/target-arc/translate-inst.h +++ b/target-arc/translate-inst.h @@ -159,3 +159,7 @@ int arc_gen_NEGSW(DisasCtxt *c, TCGv dest, TCGv src1); int arc_gen_ASLS(DisasCtxt *c, TCGv dest, TCGv src1, TCGv src2); int arc_gen_ASRS(DisasCtxt *ctx, TCGv dest, TCGv src1, TCGv src2); +int arc_gen_SLEEP(DisasCtxt *c, TCGv src1); +int arc_gen_BRK(DisasCtxt *c); +int arc_gen_FLAG(DisasCtxt *c, TCGv src1); + -- 2.4.9 (Apple Git-60)