diff --git a/linux-user/e2k/target_cpu.h b/linux-user/e2k/target_cpu.h index dbfe165c3c..fda011a175 100644 --- a/linux-user/e2k/target_cpu.h +++ b/linux-user/e2k/target_cpu.h @@ -43,7 +43,7 @@ static inline void cpu_clone_regs_child(CPUE2KState *env, target_ulong newsp, return; } - frame_size = crs.cr1.wbs * (crs.cr1.wfx ? 32 : 16); + frame_size = crs.cr1.wbs * (crs.cr1.wfx || E2K_FORCE_FX ? 32 : 16); ps_base -= frame_size; ps.index += frame_size; ps_old = lock_user(VERIFY_READ, ps_base, frame_size, 1); diff --git a/linux-user/syscall.c b/linux-user/syscall.c index fef19d201c..5860ceb35b 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7063,7 +7063,8 @@ static abi_long do_e2k_longjmp2(CPUE2KState *env, struct target_jmp_info *jmp_in return ret; } psize = crs.cr1.wpsz * 2; - ps_index -= crs.cr1.wbs * E2K_REG_LEN * (crs.cr1.wfx ? 4 : 2); + ps_index -= crs.cr1.wbs * E2K_REG_LEN * + (crs.cr1.wfx || E2K_FORCE_FX ? 4 : 2); pcsp -= CRS_SIZE; } diff --git a/target/e2k/cpu.h b/target/e2k/cpu.h index 3b4476c4bd..8c76ea2764 100644 --- a/target/e2k/cpu.h +++ b/target/e2k/cpu.h @@ -20,6 +20,14 @@ void e2k_tcg_initialize(void); /* #define TARGET_E2K_PRECISE_FSQRTID */ + +/* FIXME: nfx window mode + * numas13: I don't know why elbrus always spill/fill in fx mode. + * If we enable 'nfx' mode It will break "finish" command in gdb because + * it will try to read registers from hell. + */ +#define E2K_FORCE_FX true + #define GEN_MASK(start, len) (((1UL << (len)) - 1) << (start)) #define GET_BIT(v, index) (((v) >> (index)) & 1) diff --git a/target/e2k/helper.c b/target/e2k/helper.c index 08939fc98d..d4cb6b100d 100644 --- a/target/e2k/helper.c +++ b/target/e2k/helper.c @@ -62,7 +62,7 @@ static void ps_spill(CPUE2KState *env, int n, bool fx) for (i = 0; i < n; i += 2) { ps_push(env, env->regs[i], env->tags[i]); ps_push(env, env->regs[i + 1], env->tags[i + 1]); - if (fx) { + if (fx || E2K_FORCE_FX) { ps_push(env, env->xregs[i + 0], 0); ps_push(env, env->xregs[i + 1], 0); } @@ -73,7 +73,7 @@ static void ps_fill(CPUE2KState *env, int n, bool fx) { int i; for (i = n; i > 0; i -= 2) { - if (fx) { + if (fx || E2K_FORCE_FX) { env->xregs[i - 1] = ps_pop(env, NULL); env->xregs[i - 2] = ps_pop(env, NULL); }