diff --git a/linux-user/syscall.c b/linux-user/syscall.c index db77746926..5860ceb35b 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7089,47 +7089,6 @@ static abi_long do_e2k_longjmp2(CPUE2KState *env, struct target_jmp_info *jmp_in return 0; } - -static abi_long do_e2k_access_hw_stacks(CPUState *cpu, abi_ulong arg2, - abi_ulong arg3, abi_ulong arg4, abi_ulong arg5, abi_ulong arg6) -{ - E2KCPU *e2k_cpu = E2K_CPU(cpu); - CPUE2KState *env = &e2k_cpu->env; - int ret = 0; - abi_ulong mode = arg2; - abi_ulong frame_addr = arg3; // __user (abi_ullong *) -// abi_ulong buf_addr = arg4; // __user (char *) -// abi_ulong buf_size = arg5; - abi_ulong size_addr = arg6; // __user (void *) - - switch (mode) { - case GET_PROCEDURE_STACK_SIZE: - ret = put_user(env->psp.index, size_addr, target_ulong); - break; - case GET_CHAIN_STACK_SIZE: - ret = put_user(env->pcsp.index, size_addr, target_ulong); - break; - case GET_CHAIN_STACK_OFFSET: - ret = -TARGET_ENOSYS; - break; - case READ_CHAIN_STACK_EX: - { - abi_ullong frame = 0; - copy_user(); - - break; - } - case READ_CHAIN_STACK: - case READ_PROCEDURE_STACK: - case WRITE_PROCEDURE_STACK: - case READ_PROCEDURE_STACK_EX: - case WRITE_PROCEDURE_STACK_EX: - case WRITE_CHAIN_STACK_EX: - return -TARGET_ENOSYS; - } - return ret; -} - #endif /* end of TARGET_E2K */ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) @@ -12040,16 +11999,24 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, if (ret) { break; } - ret = do_e2k_longjmp2(env, &ji); - if (ret) { - break; - } + do_e2k_longjmp2(env, &ji); return arg2; } #endif #ifdef TARGET_NR_access_hw_stacks case TARGET_NR_access_hw_stacks: - return do_e2k_access_hw_stacks(cpu, arg1, arg2, arg3, arg4, arg5); + { +#if 0 + abi_ulong mode = arg2; + abi_ulong frame_ptr = arg3; // __user (abi_ullong *) + abi_ulong buf = arg4; // __user (char *) + abi_ulong buf_size = arg5; + abi_ulong real_size = arg6; // __user (void *) +#endif + + // TODO: e2k_sys_access_hw_stacks + return -TARGET_ENOSYS; + } #endif #ifdef CONFIG_ATTR #ifdef TARGET_NR_setxattr diff --git a/target/e2k/translate.c b/target/e2k/translate.c index 1bf5c8dc7e..2cb16a3aa8 100644 --- a/target/e2k/translate.c +++ b/target/e2k/translate.c @@ -715,11 +715,7 @@ static inline void gen_ct_cond(DisasContext *ctx) } } else { /* %MLOCK */ - if (ctx->mlock) { - tcg_gen_mov_i32(e2k_cs.ct_cond, ctx->mlock); - } else { - tcg_gen_movi_i32(e2k_cs.ct_cond, 0); - } + tcg_gen_mov_i32(e2k_cs.ct_cond, ctx->mlock); } break; case 0x9: { @@ -963,6 +959,16 @@ static inline void do_checks(DisasContext *ctx) } } +static void gen_mlock_init(DisasContext *ctx) +{ + ControlTransfer *ct = &ctx->ct; + + if (ct->type != CT_NONE && ct->cond_type == 0x8) { + ctx->mlock = e2k_get_temp_i32(ctx); + tcg_gen_movi_i32(ctx->mlock, 0); + } +} + /* * Executes instructions from a bundle and store the results to * temporary buffer. @@ -970,8 +976,10 @@ static inline void do_checks(DisasContext *ctx) static inline void do_execute(DisasContext *ctx) { ctx->loop_mode = (ctx->bundle.hs & (1 << 10)) != 0; + gen_cs0(ctx); gen_cs1(ctx); + gen_mlock_init(ctx); e2k_alc_execute(ctx); gen_ct_cond(ctx); e2k_aau_execute(ctx); @@ -1115,6 +1123,7 @@ static void e2k_tr_insn_start(DisasContextBase *db, CPUState *cs) ctx->max_r_dst = -1; ctx->max_b_cur = -1; + ctx->mlock = NULL; ctx->do_check_illtag = false; ctx->illtag = e2k_get_temp_i32(ctx); tcg_gen_movi_i32(ctx->illtag, 0); @@ -1173,8 +1182,6 @@ static void e2k_tr_translate_insn(DisasContextBase *db, CPUState *cs) do_checks(ctx); do_commit(ctx); do_branch(ctx, pc_next); - - ctx->mlock = NULL; break; } } diff --git a/target/e2k/translate/alc.c b/target/e2k/translate/alc.c index 9c6b73afcf..00b8efcda2 100644 --- a/target/e2k/translate/alc.c +++ b/target/e2k/translate/alc.c @@ -1735,9 +1735,8 @@ static inline bool gen_ld_mas_mod(DisasContext *ctx, Instr *instr, uint8_t mod) case 3: if (is_chan_25(instr->chan)) { // TODO: DAM - if (ctx->mlock == NULL) { - ctx->mlock = e2k_get_temp_i32(ctx); - /* always go to fixing code */ + /* always go to fixing code */ + if (ctx->mlock) { tcg_gen_movi_i32(ctx->mlock, 1); } return true;