diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2022-04-21 08:17:02 -0700 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2022-04-26 08:16:41 -0700 |
commit | 24ca31346e41e80166c696dd04b33027b93d8559 (patch) | |
tree | 7ff2539fecc3c37d4364cf9073fd0fd93dc21fda /target/nios2/helper.c | |
parent | bdb307b4d83bf09ae666d7b79388597f840c39d7 (diff) |
target/nios2: Create EXCP_SEMIHOST for semi-hosting
Decode 'break 1' during translation, rather than doing
it again during exception processing.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220421151735.31996-32-richard.henderson@linaro.org>
Diffstat (limited to 'target/nios2/helper.c')
-rw-r--r-- | target/nios2/helper.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/target/nios2/helper.c b/target/nios2/helper.c index a56aaaea18..1d17c0379f 100644 --- a/target/nios2/helper.c +++ b/target/nios2/helper.c @@ -152,14 +152,6 @@ void nios2_cpu_do_interrupt(CPUState *cs) case EXCP_BREAK: qemu_log_mask(CPU_LOG_INT, "BREAK exception at pc=%x\n", env->pc); - /* The semihosting instruction is "break 1". */ - if (semihosting_enabled() && - cpu_ldl_code(env, env->pc) == 0x003da07a) { - qemu_log_mask(CPU_LOG_INT, "Entering semihosting\n"); - env->pc += 4; - do_nios2_semihosting(env); - break; - } if ((env->ctrl[CR_STATUS] & CR_STATUS_EH) == 0) { env->ctrl[CR_BSTATUS] = env->ctrl[CR_STATUS]; @@ -176,6 +168,12 @@ void nios2_cpu_do_interrupt(CPUState *cs) env->pc = cpu->exception_addr; break; + case EXCP_SEMIHOST: + qemu_log_mask(CPU_LOG_INT, "BREAK semihosting at pc=%x\n", env->pc); + env->pc += 4; + do_nios2_semihosting(env); + break; + default: cpu_abort(cs, "unhandled exception type=%d\n", cs->exception_index); |