From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com>,
qemu-devel@nongnu.org
Cc: brian.cain@oss.qualcomm.com, pierrick.bouvier@oss.qualcomm.com,
marco.liebel@oss.qualcomm.com, ale@rev.ng, anjo@rev.ng
Subject: Re: [PATCH v3 10/13] target/hexagon: add COREDUMP semihosting operation
Date: Mon, 17 Aug 2026 06:34:54 +0200 [thread overview]
Message-ID: <5ce3a94f-2706-479e-98df-527e21efea8c@oss.qualcomm.com> (raw)
In-Reply-To: <9ac447d68310b348423a416a7aeb1490e2cccc5d.1784568922.git.matheus.bernardino@oss.qualcomm.com>
On 20/7/26 19:41, Matheus Tavares Bernardino wrote:
> Baremetal Hexagon programs invoke SYS_COREDUMP (0xCD)
> through semihosting to dump CPU state on a fatal exception.
> Implement the handler to decode the SSR cause field and
> print the full register file, matching hexagon-sim behavior.
>
> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> Signed-off-by: Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com>
> ---
> target/hexagon/internal.h | 1 +
> target/hexagon/cpu.c | 2 +-
> target/hexagon/hexswi.c | 143 ++++++++++++++++++++++++++++++++++++++
> 3 files changed, 145 insertions(+), 1 deletion(-)
> diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c
> index e6b2ac1939d..06c378c5e02 100644
> --- a/target/hexagon/cpu.c
> +++ b/target/hexagon/cpu.c
> @@ -232,7 +232,7 @@ void hexagon_debug_qreg(CPUHexagonState *env, int regnum)
> print_qreg(stdout, env, regnum, false);
> }
>
> -static void hexagon_dump(CPUHexagonState *env, FILE *f, int flags)
> +void hexagon_dump(CPUHexagonState *env, FILE *f, int flags)
> {
> HexagonCPU *cpu = env_archcpu(env);
>
> diff --git a/target/hexagon/hexswi.c b/target/hexagon/hexswi.c
> index 6efc00fedf9..564a11e557a 100644
> --- a/target/hexagon/hexswi.c
> +++ b/target/hexagon/hexswi.c
> @@ -162,6 +162,145 @@ static void common_semi_ftell_cb(CPUState *cs, uint64_t ret, int err)
> common_semi_cb(cs, ret, err);
> }
>
> +static void coredump(CPUHexagonState *env)
> +{
> + uint32_t ssr = arch_get_system_reg(env, HEX_SREG_SSR);
> + FILE *f = qemu_log_trylock();
> +
> + if (!f) {
> + return;
> + }
> +
> + fprintf(f, "CRASH!\n");
> + fprintf(f, "I think the exception was: ");
> + switch (GET_SSR_FIELD(SSR_CAUSE, ssr)) {
> + case 0x43:
> + fprintf(f, "0x43, NMI");
> + break;
> + case 0x42:
> + fprintf(f, "0x42, Data abort");
> + break;
> + case 0x44:
> + fprintf(f, "0x44, Multi TLB match");
> + break;
> + case HEX_CAUSE_BIU_PRECISE:
> + fprintf(f, "0x%x, Bus Error (Precise BIU error)",
> + HEX_CAUSE_BIU_PRECISE);
> + break;
[...]
Should this be moved within hexagon_dump() instead? That information
seems available and useful there.
next prev parent reply other threads:[~2026-08-17 4:35 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 17:40 [PATCH v3 00/13] hexagon: add semihosting support Matheus Tavares Bernardino
2026-07-20 17:40 ` [PATCH v3 01/13] target/hexagon: fix improper assign of cause code to exception index Matheus Tavares Bernardino
2026-07-20 17:40 ` [PATCH v3 02/13] target/hexagon: fix PC advancement for non-COF TB terminators Matheus Tavares Bernardino
2026-07-20 17:40 ` [PATCH v3 03/13] target/hexagon: add aux functions for guest mem load/store Matheus Tavares Bernardino
2026-07-20 17:41 ` [PATCH v3 04/13] hexagon: cpu_helper: add reg reading/writing helpers Matheus Tavares Bernardino
2026-08-10 3:48 ` Brian Cain
2026-07-20 17:41 ` [PATCH v3 05/13] semihosting: add APIs for chardev-aware guest fd routing Matheus Tavares Bernardino
2026-07-20 17:41 ` [PATCH v3 06/13] semihosting: add callback to set error Matheus Tavares Bernardino
2026-07-20 17:41 ` [PATCH v3 07/13] target/hexagon: add semihosting support Matheus Tavares Bernardino
2026-08-17 4:11 ` Brian Cain
2026-08-17 4:23 ` Philippe Mathieu-Daudé
2026-08-17 18:50 ` Matheus Tavares Bernardino
2026-07-20 17:41 ` [PATCH v3 08/13] semihosting: add ftruncate helper (to be used for hexagon) Matheus Tavares Bernardino
2026-07-20 17:41 ` [PATCH v3 09/13] target/hexagon: add main arch-specific semihosting operations Matheus Tavares Bernardino
2026-08-17 4:10 ` Brian Cain
2026-08-17 4:29 ` Philippe Mathieu-Daudé
2026-08-18 14:06 ` Matheus Tavares Bernardino
2026-07-20 17:41 ` [PATCH v3 10/13] target/hexagon: add COREDUMP semihosting operation Matheus Tavares Bernardino
2026-08-17 4:34 ` Philippe Mathieu-Daudé [this message]
2026-08-17 19:55 ` Matheus Tavares Bernardino
2026-07-20 17:41 ` [PATCH v3 11/13] target/hexagon: Add an errno mapping Matheus Tavares Bernardino
2026-08-17 4:41 ` Philippe Mathieu-Daudé
2026-08-17 20:09 ` Matheus Tavares Bernardino
2026-07-20 17:41 ` [PATCH v3 12/13] python/machine: support routing semihosting output to the test console Matheus Tavares Bernardino
2026-07-20 17:41 ` [PATCH v3 13/13] tests/functional: Add hexagon semihosting systests Matheus Tavares Bernardino
2026-08-17 4:47 ` Philippe Mathieu-Daudé
2026-08-19 20:25 ` Matheus Tavares Bernardino
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=5ce3a94f-2706-479e-98df-527e21efea8c@oss.qualcomm.com \
--to=philmd@oss.qualcomm.com \
--cc=ale@rev.ng \
--cc=anjo@rev.ng \
--cc=brian.cain@oss.qualcomm.com \
--cc=marco.liebel@oss.qualcomm.com \
--cc=matheus.bernardino@oss.qualcomm.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.