From: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
To: qemu-devel@nongnu.org
Cc: kbastian@mail.uni-paderborn.de
Subject: [PATCH 6/6] target/tricore: Enable semihosting
Date: Sun, 15 Oct 2023 22:59:13 +0200 [thread overview]
Message-ID: <20231015205913.264782-7-kbastian@mail.uni-paderborn.de> (raw)
In-Reply-To: <20231015205913.264782-1-kbastian@mail.uni-paderborn.de>
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
---
configs/devices/tricore-softmmu/default.mak | 1 +
docs/about/emulation.rst | 3 +++
qemu-options.hx | 3 ++-
target/tricore/translate.c | 13 +++++++++++--
4 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/configs/devices/tricore-softmmu/default.mak b/configs/devices/tricore-softmmu/default.mak
index cb8fc286eb..883903073c 100644
--- a/configs/devices/tricore-softmmu/default.mak
+++ b/configs/devices/tricore-softmmu/default.mak
@@ -1,2 +1,3 @@
CONFIG_TRICORE_TESTBOARD=y
CONFIG_TRIBOARD=y
+CONFIG_SEMIHOSTING=y
diff --git a/docs/about/emulation.rst b/docs/about/emulation.rst
index 0ad0b86f0d..3ee90bd2aa 100644
--- a/docs/about/emulation.rst
+++ b/docs/about/emulation.rst
@@ -185,6 +185,9 @@ for that architecture.
* - RISC-V
- System and User-mode
- https://github.com/riscv/riscv-semihosting-spec/blob/main/riscv-semihosting-spec.adoc
+ * - TriCore
+ - System
+ - Infineon ISS syscall handling (for GNU tools)
* - Xtensa
- System
- Tensilica ISS SIMCALL
diff --git a/qemu-options.hx b/qemu-options.hx
index 54a7e94970..d7a6cb94c9 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -4816,7 +4816,8 @@ ERST
DEF("semihosting", 0, QEMU_OPTION_semihosting,
"-semihosting semihosting mode\n",
QEMU_ARCH_ARM | QEMU_ARCH_M68K | QEMU_ARCH_XTENSA |
- QEMU_ARCH_MIPS | QEMU_ARCH_NIOS2 | QEMU_ARCH_RISCV)
+ QEMU_ARCH_MIPS | QEMU_ARCH_NIOS2 | QEMU_ARCH_RISCV |
+ QEMU_ARCH_TRICORE)
SRST
``-semihosting``
Enable :ref:`Semihosting` mode (ARM, M68K, Xtensa, MIPS, Nios II, RISC-V only).
diff --git a/target/tricore/translate.c b/target/tricore/translate.c
index dd812ec0f0..1eb44c78c2 100644
--- a/target/tricore/translate.c
+++ b/target/tricore/translate.c
@@ -25,6 +25,7 @@
#include "tcg/tcg-op.h"
#include "exec/cpu_ldst.h"
#include "qemu/qemu-print.h"
+#include "semihosting/semihost.h"
#include "exec/helper-proto.h"
#include "exec/helper-gen.h"
@@ -3151,6 +3152,14 @@ static void gen_compute_branch(DisasContext *ctx, uint32_t opc, int r1,
}
}
+static void gen_debug(DisasContext *ctx)
+{
+ if (semihosting_enabled(false)) {
+ gen_helper_1arg(tricore_semihost, ctx->base.pc_next);
+ } else {
+ /* raise EXCP_DEBUG */
+ }
+}
/*
* Functions for decoding instructions
@@ -3497,7 +3506,7 @@ static void decode_sr_system(DisasContext *ctx)
ctx->base.is_jmp = DISAS_EXIT;
break;
case OPC2_16_SR_DEBUG:
- /* raise EXCP_DEBUG */
+ gen_debug(ctx);
break;
case OPC2_16_SR_FRET:
gen_fret(ctx);
@@ -7926,7 +7935,7 @@ static void decode_sys_interrupts(DisasContext *ctx)
switch (op2) {
case OPC2_32_SYS_DEBUG:
- /* raise EXCP_DEBUG */
+ gen_debug(ctx);
break;
case OPC2_32_SYS_DISABLE:
if (ctx->priv == TRICORE_PRIV_SM || ctx->priv == TRICORE_PRIV_UM1) {
--
2.42.0
prev parent reply other threads:[~2023-10-15 21:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-15 20:59 [PATCH 0/6] TriCore Semihosting Bastian Koppelmann
2023-10-15 20:59 ` [PATCH 1/6] target/tricore: Add semihosting stub Bastian Koppelmann
2023-10-15 20:59 ` [PATCH 2/6] target/tricore: Add read and write semihosting calls Bastian Koppelmann
2023-10-15 23:48 ` Richard Henderson
2023-10-15 20:59 ` [PATCH 3/6] target/tricore: Add lseek semihosting call Bastian Koppelmann
2023-10-15 20:59 ` [PATCH 4/6] target/tricore: Add close " Bastian Koppelmann
2023-10-15 20:59 ` [PATCH 5/6] target/tricore: Add open and creat semihosting calls Bastian Koppelmann
2023-10-15 20:59 ` Bastian Koppelmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231015205913.264782-7-kbastian@mail.uni-paderborn.de \
--to=kbastian@mail.uni-paderborn.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).