[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1 3/9] target/arm: handle A-profile A32 semihosting
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PATCH v1 3/9] target/arm: handle A-profile A32 semihosting at translate time |
Date: |
Wed, 28 Aug 2019 17:53:01 +0100 |
As for the other semihosting calls we can resolve this at translate
time.
Signed-off-by: Alex Bennée <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
---
target/arm/translate.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/target/arm/translate.c b/target/arm/translate.c
index 6157e9f52fc..9dc7ec78061 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -7657,6 +7657,22 @@ static void arm_skip_unless(DisasContext *s, uint32_t
cond)
arm_gen_test_cc(cond ^ 1, s->condlabel);
}
+static inline void gen_arm_swi(DisasContext *s, int imm24)
+{
+ if (semihosting_enabled() &&
+#ifndef CONFIG_USER_ONLY
+ s->current_el != 0 &&
+#endif
+ (imm24 == 0x123456)) {
+ gen_exception_internal_insn(s, 0, EXCP_SEMIHOST);
+ return;
+ }
+
+ gen_set_pc_im(s, s->base.pc_next);
+ s->svc_imm = imm24;
+ s->base.is_jmp = DISAS_SWI;
+}
+
static void disas_arm_insn(DisasContext *s, unsigned int insn)
{
unsigned int cond, val, op1, i, shift, rm, rs, rn, rd, sh;
@@ -9195,9 +9211,7 @@ static void disas_arm_insn(DisasContext *s, unsigned int
insn)
break;
case 0xf:
/* swi */
- gen_set_pc_im(s, s->base.pc_next);
- s->svc_imm = extract32(insn, 0, 24);
- s->base.is_jmp = DISAS_SWI;
+ gen_arm_swi(s, extract32(insn, 0, 24));
break;
default:
illegal_op:
--
2.20.1
- [Qemu-devel] [PATCH v1 0/9] arm semih-hosting cleanups and other misc cleanups, Alex Bennée, 2019/08/28
- [Qemu-devel] [PATCH v1 2/9] target/arm: handle A-profile T32 semihosting at translate time, Alex Bennée, 2019/08/28
- [Qemu-devel] [PATCH v1 6/9] tcg/README: fix typo s/afterwise/afterwards/, Alex Bennée, 2019/08/28
- [Qemu-devel] [PATCH v1 5/9] includes: remove stale [smp|max]_cpus externs, Alex Bennée, 2019/08/28
- [Qemu-devel] [PATCH v1 1/9] target/arm: handle M-profile semihosting at translate time, Alex Bennée, 2019/08/28
- [Qemu-devel] [PATCH v1 7/9] atomic_template: fix indentation in GEN_ATOMIC_HELPER, Alex Bennée, 2019/08/28
- [Qemu-devel] [PATCH v1 3/9] target/arm: handle A-profile A32 semihosting at translate time,
Alex Bennée <=
- [Qemu-devel] [PATCH v1 4/9] target/arm: remove run time semihosting checks, Alex Bennée, 2019/08/28
- [Qemu-devel] [PATCH v1 9/9] include/exec/cpu-defs.h: fix typo, Alex Bennée, 2019/08/28
- [Qemu-devel] [PATCH v1 8/9] accel/stubs: reduce headers from tcg-stub, Alex Bennée, 2019/08/28
- Re: [Qemu-devel] [PATCH v1 0/9] arm semih-hosting cleanups and other misc cleanups, Philippe Mathieu-Daudé, 2019/08/29