e2k: Always SPILL/FILL in FX window mode.

It will fix 'finish' command in gdb.

Signed-off-by: Denis Drakhnya <numas13@gmail.com>
This commit is contained in:
Denis Drakhnia 2021-02-14 12:20:21 +02:00 committed by Denis Drakhnia
parent 9e87995802
commit 7198f44549
4 changed files with 13 additions and 4 deletions

View File

@ -43,7 +43,7 @@ static inline void cpu_clone_regs_child(CPUE2KState *env, target_ulong newsp,
return; 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_base -= frame_size;
ps.index += frame_size; ps.index += frame_size;
ps_old = lock_user(VERIFY_READ, ps_base, frame_size, 1); ps_old = lock_user(VERIFY_READ, ps_base, frame_size, 1);

View File

@ -7063,7 +7063,8 @@ static abi_long do_e2k_longjmp2(CPUE2KState *env, struct target_jmp_info *jmp_in
return ret; return ret;
} }
psize = crs.cr1.wpsz * 2; 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; pcsp -= CRS_SIZE;
} }

View File

@ -20,6 +20,14 @@ void e2k_tcg_initialize(void);
/* #define TARGET_E2K_PRECISE_FSQRTID */ /* #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 GEN_MASK(start, len) (((1UL << (len)) - 1) << (start))
#define GET_BIT(v, index) (((v) >> (index)) & 1) #define GET_BIT(v, index) (((v) >> (index)) & 1)

View File

@ -62,7 +62,7 @@ static void ps_spill(CPUE2KState *env, int n, bool fx)
for (i = 0; i < n; i += 2) { for (i = 0; i < n; i += 2) {
ps_push(env, env->regs[i], env->tags[i]); ps_push(env, env->regs[i], env->tags[i]);
ps_push(env, env->regs[i + 1], env->tags[i + 1]); 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 + 0], 0);
ps_push(env, env->xregs[i + 1], 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; int i;
for (i = n; i > 0; i -= 2) { 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 - 1] = ps_pop(env, NULL);
env->xregs[i - 2] = ps_pop(env, NULL); env->xregs[i - 2] = ps_pop(env, NULL);
} }