target: e2k: %cr0 must hold pregs and ip of previous procedure.

This commit is contained in:
Denis Drakhnia 2020-12-13 17:40:30 +02:00 committed by Denis Drakhnia
parent 37b4ee19b0
commit d402c52f4a
3 changed files with 11 additions and 10 deletions

View File

@ -475,15 +475,12 @@ typedef struct CPUArchState {
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 */

View File

@ -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

View File

@ -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;