From f78a8ea23fd6c778bc7e6ebc0222627c706c8ab2 Mon Sep 17 00:00:00 2001 From: Denis Drakhnya Date: Tue, 24 Nov 2020 22:50:33 +0200 Subject: [PATCH] target: e2k: Remove helper unimpl. --- linux-user/e2k/cpu_loop.c | 7 ------- target/e2k/cpu.h | 1 - target/e2k/helper.c | 14 ++++--------- target/e2k/helper.h | 1 - target/e2k/translate.c | 2 +- target/e2k/translate/alc.c | 36 +++++++++++++++++----------------- target/e2k/translate/control.c | 26 ++++++++++++------------ target/e2k/translate/plu.c | 8 ++++---- 8 files changed, 40 insertions(+), 55 deletions(-) diff --git a/linux-user/e2k/cpu_loop.c b/linux-user/e2k/cpu_loop.c index 970aeadf79..e9fc83f958 100644 --- a/linux-user/e2k/cpu_loop.c +++ b/linux-user/e2k/cpu_loop.c @@ -37,13 +37,6 @@ void cpu_loop(CPUE2KState *env) process_queued_cpu_work(cs); switch (trapnr) { - case E2K_EXCP_UNIMPL: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLOPC; - info._sifields._sigfault._addr = env->ip; - queue_signal(env, info.si_signo, QEMU_SI_KILL, &info); - break; case E2K_EXCP_SYSCALL: { int offset = env->wd_base + env->syscall_wbs * 2; uint64_t *regs = env->wregs; diff --git a/target/e2k/cpu.h b/target/e2k/cpu.h index bda14d00ec..01b010bdf8 100644 --- a/target/e2k/cpu.h +++ b/target/e2k/cpu.h @@ -233,7 +233,6 @@ void e2k_tcg_initialize(void); #define IDR_WBL_TO_BYTES(wbl) ((wbl) ? (1 << ((wbs) + 4)) : 1) typedef enum { - E2K_EXCP_UNIMPL = 0x01, E2K_EXCP_SYSCALL = 0x02, E2K_EXCP_ILLOPC = 0x03, E2K_EXCP_ILLOPN = 0x04, diff --git a/target/e2k/helper.c b/target/e2k/helper.c index a86fb58d42..f5ec5632a5 100644 --- a/target/e2k/helper.c +++ b/target/e2k/helper.c @@ -49,14 +49,6 @@ static inline void restore_br_state(CPUE2KState *env) env->pcur = GET_FIELD(env->br, BR_PCUR_OFF, BR_PCUR_LEN); } -void helper_unimpl(CPUE2KState *env) -{ - CPUState *cs = env_cpu(env); - - cs->exception_index = E2K_EXCP_UNIMPL; - cpu_loop_exit(cs); -} - static void pcs_push(CPUE2KState *env, int wbs) { size_t size = e2k_state_pcs_size_get(env); @@ -184,9 +176,11 @@ target_ulong helper_call(CPUE2KState *env, uint64_t ctpr, do_syscall(env, call_wbs); return env->ip; default: - helper_raise_exception(env, E2K_EXCP_UNIMPL); - return env->ip; + abort(); + break; } + + return 0; } void helper_raise_exception(CPUE2KState *env, int tt) diff --git a/target/e2k/helper.h b/target/e2k/helper.h index a390c8d86f..b013294512 100644 --- a/target/e2k/helper.h +++ b/target/e2k/helper.h @@ -1,4 +1,3 @@ -DEF_HELPER_1(unimpl, noreturn, env) DEF_HELPER_2(raise_exception, noreturn, env, int) DEF_HELPER_1(debug, void, env) DEF_HELPER_1(return, void, env) diff --git a/target/e2k/translate.c b/target/e2k/translate.c index 008e958733..7018816a62 100644 --- a/target/e2k/translate.c +++ b/target/e2k/translate.c @@ -386,7 +386,7 @@ static inline void do_branch(DisasContext *ctx) tcg_temp_free_i64(t0); // TODO: ldisp, sdisp - e2k_gen_exception(ctx, E2K_EXCP_UNIMPL); + e2k_gen_exception(ctx, 0); gen_set_label(l0); gen_goto_ctpr_disp(ctx->ct.u.ctpr); diff --git a/target/e2k/translate/alc.c b/target/e2k/translate/alc.c index 6655ba60b5..6d5c6f54dc 100644 --- a/target/e2k/translate/alc.c +++ b/target/e2k/translate/alc.c @@ -81,7 +81,7 @@ static TCGv_i64 get_dst(DisasContext *dc, unsigned int als) return e2k_get_greg(dc, i); } else { // TODO: %empty, %ctpr, etc - gen_helper_unimpl(cpu_env); + abort(); } // TODO: remove return e2k_get_temp_i64(dc); @@ -105,7 +105,7 @@ static void store_reg_alc_result(DisasContext *dc, int chan, TCGv_i64 val) res->u.reg.i = GET_GLOBAL(dst); } else { // TODO: %empty, %ctpr, etc - gen_helper_unimpl(cpu_env); + abort(); } } @@ -252,12 +252,12 @@ static inline void gen_getfd(TCGv_i64 ret, TCGv_i64 src1, TCGv_i64 src2) static TCGCond e2k_gen_cmp_op(unsigned int cmp_op) { switch(cmp_op) { - case 0: gen_helper_unimpl(cpu_env); break; + case 0: abort(); break; case 1: return TCG_COND_LTU; break; case 2: return TCG_COND_EQ; break; case 3: return TCG_COND_LEU; break; - case 4: gen_helper_unimpl(cpu_env); break; - case 5: gen_helper_unimpl(cpu_env); break; + case 4: abort(); break; + case 5: abort(); break; case 6: return TCG_COND_LT; break; case 7: return TCG_COND_LE; break; default: g_assert_not_reached(); break; @@ -767,28 +767,28 @@ static void execute_alopf_simple(DisasContext *dc, int chan) case 0x1f: /* getfd */ gen_alopf1_i64(dc, chan, gen_getfd); break; case 0x20: if (chan == 2 || chan == 5) { - gen_helper_unimpl(cpu_env); + abort(); } else { gen_cmpsb(dc, chan); /* cmp{op}sb */ } break; case 0x21: if (chan == 2 || chan == 5) { - gen_helper_unimpl(cpu_env); + abort(); } else { gen_cmpdb(dc, chan); /* cmp{op}db */ } break; case 0x22: if (chan == 2 || chan == 5) { - gen_helper_unimpl(cpu_env); + abort(); } else { gen_cmpandsb(dc, chan); /* cmpand{op}sb */ } break; case 0x23: if (chan == 2 || chan == 5) { - gen_helper_unimpl(cpu_env); + abort(); } else { gen_cmpanddb(dc, chan); /* cmpand{op}db */ } @@ -797,7 +797,7 @@ static void execute_alopf_simple(DisasContext *dc, int chan) if (chan == 2 || chan == 5) { gen_st(dc, chan, MO_UB); } else { - gen_helper_unimpl(cpu_env); + abort(); } break; } @@ -805,7 +805,7 @@ static void execute_alopf_simple(DisasContext *dc, int chan) if (chan == 2 || chan == 5) { gen_st(dc, chan, MO_UW); } else { - gen_helper_unimpl(cpu_env); + abort(); } break; } @@ -813,7 +813,7 @@ static void execute_alopf_simple(DisasContext *dc, int chan) if (chan == 2 || chan == 5) { gen_st(dc, chan, MO_UL); } else { - gen_helper_unimpl(cpu_env); + abort(); } break; } @@ -821,7 +821,7 @@ static void execute_alopf_simple(DisasContext *dc, int chan) if (chan == 2 || chan == 5) { gen_st(dc, chan, MO_Q); } else { - gen_helper_unimpl(cpu_env); + abort(); } break; } @@ -830,14 +830,14 @@ static void execute_alopf_simple(DisasContext *dc, int chan) break; case 0x61: if (chan == 2 || chan == 5) { - gen_helper_unimpl(cpu_env); + abort(); } else { gen_movtd(dc, chan); } break; case 0x64: { /* ldb */ if (chan == 1 || chan == 4) { - gen_helper_unimpl(cpu_env); + abort(); } else { gen_ld(dc, chan, MO_UB); } @@ -845,7 +845,7 @@ static void execute_alopf_simple(DisasContext *dc, int chan) } case 0x65: { /* ldh */ if (chan == 1 || chan == 4) { - gen_helper_unimpl(cpu_env); + abort(); } else { gen_ld(dc, chan, MO_UW); } @@ -853,7 +853,7 @@ static void execute_alopf_simple(DisasContext *dc, int chan) } case 0x66: { /* ldw */ if (chan == 1 || chan == 4) { - gen_helper_unimpl(cpu_env); + abort(); } else { gen_ld(dc, chan, MO_UL); } @@ -861,7 +861,7 @@ static void execute_alopf_simple(DisasContext *dc, int chan) } case 0x67: { /* ldd */ if (chan == 1 || chan == 4) { - gen_helper_unimpl(cpu_env); + abort(); } else { gen_ld(dc, chan, MO_Q); } diff --git a/target/e2k/translate/control.c b/target/e2k/translate/control.c index 8bca7e222d..48f10b2bbc 100644 --- a/target/e2k/translate/control.c +++ b/target/e2k/translate/control.c @@ -143,11 +143,11 @@ void e2k_commit_stubs(DisasContext *ctx) break; case 0x01: // TODO - gen_helper_unimpl(cpu_env); + abort(); break; case 0x02: // TODO - gen_helper_unimpl(cpu_env); + abort(); break; default: e2k_gen_exception(ctx, E2K_EXCP_ILLOPC); @@ -295,7 +295,7 @@ static void gen_cs0(DisasContext *dc) "invalid gettsd" if this turns out not to be the case . . . */ if (type == GETTSD) { // TODO: gettsd - gen_helper_unimpl(cpu_env); + abort(); } if (type == PUTTSD) { @@ -312,7 +312,7 @@ static void gen_cs0(DisasContext *dc) both on 32 and 64-bit hosts. */ // (unsigned long long) (instr_addr + sgnd_disp)); // TODO: puttsd - gen_helper_unimpl(cpu_env); + abort(); } if (type == PREF) { @@ -320,7 +320,7 @@ static void gen_cs0(DisasContext *dc) // unsigned int ipd = (bundle->cs0 & 0x00000008) >> 3; // unsigned int prefr = bundle->cs0 & 0x00000007; // TODO: pref - gen_helper_unimpl(cpu_env); + abort(); } } } @@ -355,7 +355,7 @@ static void gen_cs1(DisasContext *dc) seems to be the case even if no SETWD has been explicitly specified. */ // unsigned int rpsz = (bundle->lts[0] & 0x0001f000) >> 12; - gen_helper_unimpl(cpu_env); + abort(); } } @@ -395,14 +395,14 @@ static void gen_cs1(DisasContext *dc) if (sft) { if (dc->version >= 2) { // TODO: setsft - gen_helper_unimpl(cpu_env); + abort(); } else { e2k_gen_exception(dc, E2K_EXCP_ILLOPC); } } else { // uint8_t eir = GET_FIELD_LEN(cs1, 0, 8); // TODO: setei - gen_helper_unimpl(cpu_env); + abort(); } } else if (opc == WAIT) { // TODO: wait @@ -433,7 +433,7 @@ static void gen_cs1(DisasContext *dc) // my_printf ("trap = %d, ", trap); } - gen_helper_unimpl(cpu_env); + abort(); // my_printf ("ma_c = %d, fl_c = %d, ld_c = %d, st_c = %d, all_e = %d, " // "all_c = %d", ma_c, fl_c, ld_c, st_c, all_e, all_c); } else if (opc == CALL) { @@ -452,7 +452,7 @@ static void gen_cs1(DisasContext *dc) if (cs0_opc == 0) { // unsigned int hdisp = (cs0 & 0x1e) >> 1; // TODO: hcall hdisp, wbs ? cond - gen_helper_unimpl(cpu_env); + abort(); } } else { e2k_gen_exception(dc, E2K_EXCP_ILLOPC); @@ -466,12 +466,12 @@ static void gen_cs1(DisasContext *dc) } else if (opc == FLUSHR) { if (cs1 & 0x00000001) { // TODO: flushr - gen_helper_unimpl(cpu_env); + abort(); } if (cs1 & 0x00000002) { // TODO: flushc - gen_helper_unimpl(cpu_env); + abort(); } } else if (opc == BG) { // unsigned int chkm4 = (cs1 & 0x00010000) >> 16; @@ -479,7 +479,7 @@ static void gen_cs1(DisasContext *dc) // unsigned int umsk = cs1 & 0x000000ff; // TODO: vfbg - gen_helper_unimpl(cpu_env); + abort(); } else { e2k_gen_exception(dc, E2K_EXCP_ILLOPC); } diff --git a/target/e2k/translate/plu.c b/target/e2k/translate/plu.c index 27686a1341..20ae4eb2a4 100644 --- a/target/e2k/translate/plu.c +++ b/target/e2k/translate/plu.c @@ -18,16 +18,16 @@ void e2k_gen_cond_i32(DisasContext *ctx, TCGv_i32 ret, uint8_t psrc) e2k_gen_lcntex(ret); } else { // TODO: spred - gen_helper_unimpl(cpu_env); + abort(); } } else if (GET_FIELD(psrc, 5, 2) == 0x40) { int val = GET_FIELD(psrc, 0, 5); if (val == 0) { // TODO: bgrpred - gen_helper_unimpl(cpu_env); + abort(); } else if (val <= 15) { // TODO: rndpred - gen_helper_unimpl(cpu_env); + abort(); } else { e2k_gen_exception(ctx, E2K_EXCP_ILLOPN); } @@ -172,7 +172,7 @@ void e2k_plu_execute(DisasContext *ctx) break; } default: - gen_helper_unimpl(cpu_env); + abort(); break; } }