mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
target/nios2: Split PC out of env->regs[]
It is cleaner to have a separate name for this variable. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220421151735.31996-17-richard.henderson@linaro.org>
This commit is contained in:
parent
5ea3e9975b
commit
17a406eec5
7 changed files with 58 additions and 65 deletions
|
@ -1170,7 +1170,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
|
|||
(*regs)[30] = -1; /* R_SSTATUS */
|
||||
(*regs)[31] = tswapreg(env->regs[R_RA]);
|
||||
|
||||
(*regs)[32] = tswapreg(env->regs[R_PC]);
|
||||
(*regs)[32] = tswapreg(env->pc);
|
||||
|
||||
(*regs)[33] = -1; /* R_STATUS */
|
||||
(*regs)[34] = tswapreg(env->regs[CR_ESTATUS]);
|
||||
|
|
|
@ -43,7 +43,7 @@ void cpu_loop(CPUNios2State *env)
|
|||
* TODO: This advance should be done in the translator, as
|
||||
* hardware produces an advanced pc as part of all exceptions.
|
||||
*/
|
||||
env->regs[R_PC] += 4;
|
||||
env->pc += 4;
|
||||
|
||||
switch (env->error_code) {
|
||||
case 0:
|
||||
|
@ -59,7 +59,7 @@ void cpu_loop(CPUNios2State *env)
|
|||
break;
|
||||
}
|
||||
if (ret == -QEMU_ERESTARTSYS) {
|
||||
env->regs[R_PC] -= 4;
|
||||
env->pc -= 4;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
|
@ -74,22 +74,21 @@ void cpu_loop(CPUNios2State *env)
|
|||
|
||||
case 1:
|
||||
qemu_log_mask(CPU_LOG_INT, "\nTrap 1\n");
|
||||
force_sig_fault(TARGET_SIGUSR1, 0, env->regs[R_PC]);
|
||||
force_sig_fault(TARGET_SIGUSR1, 0, env->pc);
|
||||
break;
|
||||
case 2:
|
||||
qemu_log_mask(CPU_LOG_INT, "\nTrap 2\n");
|
||||
force_sig_fault(TARGET_SIGUSR2, 0, env->regs[R_PC]);
|
||||
force_sig_fault(TARGET_SIGUSR2, 0, env->pc);
|
||||
break;
|
||||
case 31:
|
||||
qemu_log_mask(CPU_LOG_INT, "\nTrap 31\n");
|
||||
/* Match kernel's breakpoint_c(). */
|
||||
env->regs[R_PC] -= 4;
|
||||
force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->regs[R_PC]);
|
||||
env->pc -= 4;
|
||||
force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc);
|
||||
break;
|
||||
default:
|
||||
qemu_log_mask(CPU_LOG_INT, "\nTrap %d\n", env->error_code);
|
||||
force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLTRP,
|
||||
env->regs[R_PC]);
|
||||
force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLTRP, env->pc);
|
||||
break;
|
||||
|
||||
case 16: /* QEMU specific, for __kuser_cmpxchg */
|
||||
|
@ -120,7 +119,7 @@ void cpu_loop(CPUNios2State *env)
|
|||
break;
|
||||
|
||||
case EXCP_DEBUG:
|
||||
force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->regs[R_PC]);
|
||||
force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc);
|
||||
break;
|
||||
default:
|
||||
EXCP_DUMP(env, "\nqemu: unhandled CPU exception %#x - aborting\n",
|
||||
|
@ -156,6 +155,6 @@ void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs)
|
|||
env->regs[R_SP] = regs->sp;
|
||||
env->regs[R_GP] = regs->gp;
|
||||
env->regs[CR_ESTATUS] = regs->estatus;
|
||||
env->regs[R_PC] = regs->ea;
|
||||
env->pc = regs->ea;
|
||||
/* TODO: unsigned long orig_r7; */
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ static void rt_setup_ucontext(struct target_ucontext *uc, CPUNios2State *env)
|
|||
__put_user(env->regs[R_RA], &gregs[23]);
|
||||
__put_user(env->regs[R_FP], &gregs[24]);
|
||||
__put_user(env->regs[R_GP], &gregs[25]);
|
||||
__put_user(env->regs[R_PC], &gregs[27]);
|
||||
__put_user(env->pc, &gregs[27]);
|
||||
__put_user(env->regs[R_SP], &gregs[28]);
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ static int rt_restore_ucontext(CPUNios2State *env, struct target_ucontext *uc)
|
|||
__get_user(env->regs[R_GP], &gregs[25]);
|
||||
/* Not really necessary no user settable bits */
|
||||
__get_user(temp, &gregs[26]);
|
||||
__get_user(env->regs[R_PC], &gregs[27]);
|
||||
__get_user(env->pc, &gregs[27]);
|
||||
|
||||
__get_user(env->regs[R_RA], &gregs[23]);
|
||||
__get_user(env->regs[R_SP], &gregs[28]);
|
||||
|
@ -177,7 +177,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
|
|||
env->regs[4] = sig;
|
||||
env->regs[5] = frame_addr + offsetof(struct target_rt_sigframe, info);
|
||||
env->regs[6] = frame_addr + offsetof(struct target_rt_sigframe, uc);
|
||||
env->regs[R_PC] = ka->_sa_handler;
|
||||
env->pc = ka->_sa_handler;
|
||||
|
||||
unlock_user_struct(frame, frame_addr, 1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue