summaryrefslogtreecommitdiff
path: root/target-lm32
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-08-26 08:31:06 +0200
committerAndreas Färber <afaerber@suse.de>2014-03-13 19:20:46 +0100
commit27103424c40ce71053c07d8a54ef431365fa9b7f (patch)
treebec190ce2f52c17d5f5963d743f6c64af47c9240 /target-lm32
parent6f03bef0ffc5cd75ac5ffcca0383c489ae48108c (diff)
downloadqemu-27103424c40ce71053c07d8a54ef431365fa9b7f.tar.gz
qemu-27103424c40ce71053c07d8a54ef431365fa9b7f.tar.bz2
qemu-27103424c40ce71053c07d8a54ef431365fa9b7f.zip
cpu: Move exception_index field from CPU_COMMON to CPUState
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'target-lm32')
-rw-r--r--target-lm32/helper.c12
-rw-r--r--target-lm32/op_helper.c6
2 files changed, 10 insertions, 8 deletions
diff --git a/target-lm32/helper.c b/target-lm32/helper.c
index ce6dd45552..e5536c0ecb 100644
--- a/target-lm32/helper.c
+++ b/target-lm32/helper.c
@@ -147,9 +147,9 @@ void lm32_cpu_do_interrupt(CPUState *cs)
CPULM32State *env = &cpu->env;
qemu_log_mask(CPU_LOG_INT,
- "exception at pc=%x type=%x\n", env->pc, env->exception_index);
+ "exception at pc=%x type=%x\n", env->pc, cs->exception_index);
- switch (env->exception_index) {
+ switch (cs->exception_index) {
case EXCP_INSN_BUS_ERROR:
case EXCP_DATA_BUS_ERROR:
case EXCP_DIVIDE_BY_ZERO:
@@ -160,9 +160,9 @@ void lm32_cpu_do_interrupt(CPUState *cs)
env->ie |= (env->ie & IE_IE) ? IE_EIE : 0;
env->ie &= ~IE_IE;
if (env->dc & DC_RE) {
- env->pc = env->deba + (env->exception_index * 32);
+ env->pc = env->deba + (cs->exception_index * 32);
} else {
- env->pc = env->eba + (env->exception_index * 32);
+ env->pc = env->eba + (cs->exception_index * 32);
}
log_cpu_state_mask(CPU_LOG_INT, cs, 0);
break;
@@ -172,12 +172,12 @@ void lm32_cpu_do_interrupt(CPUState *cs)
env->regs[R_BA] = env->pc;
env->ie |= (env->ie & IE_IE) ? IE_BIE : 0;
env->ie &= ~IE_IE;
- env->pc = env->deba + (env->exception_index * 32);
+ env->pc = env->deba + (cs->exception_index * 32);
log_cpu_state_mask(CPU_LOG_INT, cs, 0);
break;
default:
cpu_abort(env, "unhandled exception type=%d\n",
- env->exception_index);
+ cs->exception_index);
break;
}
}
diff --git a/target-lm32/op_helper.c b/target-lm32/op_helper.c
index 774dc65cf2..3b513a7edb 100644
--- a/target-lm32/op_helper.c
+++ b/target-lm32/op_helper.c
@@ -25,7 +25,9 @@
void raise_exception(CPULM32State *env, int index)
{
- env->exception_index = index;
+ CPUState *cs = CPU(lm32_env_get_cpu(env));
+
+ cs->exception_index = index;
cpu_loop_exit(env);
}
@@ -39,7 +41,7 @@ void HELPER(hlt)(CPULM32State *env)
CPUState *cs = CPU(lm32_env_get_cpu(env));
cs->halted = 1;
- env->exception_index = EXCP_HLT;
+ cs->exception_index = EXCP_HLT;
cpu_loop_exit(env);
}