diff --git a/target/e2k/cpu.h b/target/e2k/cpu.h index ae124bbdc2..cb02e2e47c 100644 --- a/target/e2k/cpu.h +++ b/target/e2k/cpu.h @@ -475,15 +475,12 @@ typedef struct { uint8_t tags[E2K_REG_COUNT]; /* registers tags */ uint64_t *rptr; /* pointer to regs */ uint8_t *tptr; /* pointer to tags */ + uint64_t pregs; /* predicate file */ + target_ulong ip; /* instruction address */ - union { - uint64_t pregs; /* predicate file */ - uint64_t cr0_lo; - }; - union { - target_ulong ip; /* instruction address */ - uint64_t cr0_hi; - }; + /* procedure chain info */ + uint64_t cr0_lo; + uint64_t cr0_hi; E2KCr1State cr1; /* Procedure chain info = cr0_lo, cr0_hi, cr1_lo, cr1_hi */ diff --git a/target/e2k/gdbstub.c b/target/e2k/gdbstub.c index 12179c4690..31913f9d0c 100644 --- a/target/e2k/gdbstub.c +++ b/target/e2k/gdbstub.c @@ -60,8 +60,8 @@ int e2k_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) case 49: return gdb_get_reg64(mem_buf, e2k_state_psp_lo(env)); // psp_lo case 50: return gdb_get_reg64(mem_buf, e2k_state_psp_hi(env)); // psp_hi case 51: return gdb_get_reg64(mem_buf, e2k_state_pshtp(env)); // pshtp - case 52: return gdb_get_reg64(mem_buf, env->cr0_lo); // cr0_lo - case 53: return gdb_get_reg64(mem_buf, env->cr0_hi); // cr0_hi + case 52: return gdb_get_reg64(mem_buf, env->pregs); // pregs + case 53: return gdb_get_reg64(mem_buf, env->ip); // ip case 54: return gdb_get_reg64(mem_buf, e2k_state_cr1_lo(env)); // cr1_lo case 55: return gdb_get_reg64(mem_buf, e2k_state_cr1_hi(env)); // cr1_hi case 56: return gdb_get_reg64(mem_buf, 0); // cwd diff --git a/target/e2k/helper.c b/target/e2k/helper.c index 816bc0c13d..9e70912f3a 100644 --- a/target/e2k/helper.c +++ b/target/e2k/helper.c @@ -78,6 +78,8 @@ static void proc_chain_save(CPUE2KState *env, int wbs) env->pshtp.index += wbs * 2; + env->cr0_lo = env->pregs; + env->cr0_hi = env->ip; env->cr1.wbs = wbs; env->cr1.wpsz = env->wd.psize / 2; env->cr1.wfx = env->wd.fx; @@ -103,6 +105,8 @@ static inline void proc_chain_restore(CPUE2KState *env) env->cr0_hi = pcs_pop(env); // FIXME: is it necessary to restore ip? env->cr0_lo = pcs_pop(env); + env->pregs = env->cr0_lo; + env->ip = env->cr0_hi; wbs = env->cr1.wbs; e2k_state_br_set(env, env->cr1.br); env->wd.size = env->wd.psize + wbs * 2;