From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: Re: [PATCH for-10.1 1/2] linux-user/aarch64: Check syndrome for EXCP_UDEF
Date: Fri, 25 Jul 2025 10:11:20 -0700 [thread overview]
Message-ID: <6f24a5df-d191-4581-a02d-753a98c6bbf1@linaro.org> (raw)
In-Reply-To: <20250725165106.37105-2-richard.henderson@linaro.org>
On 7/25/25 9:51 AM, Richard Henderson wrote:
> Note that we have been passing the incorrect code for
> uncategorized and bti faults.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> linux-user/aarch64/cpu_loop.c | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c
> index fea43cefa6..43a471b535 100644
> --- a/linux-user/aarch64/cpu_loop.c
> +++ b/linux-user/aarch64/cpu_loop.c
> @@ -32,6 +32,7 @@ void cpu_loop(CPUARMState *env)
> {
> CPUState *cs = env_cpu(env);
> int trapnr, ec, fsc, si_code, si_signo;
> + uint64_t addr;
> abi_long ret;
>
> for (;;) {
> @@ -63,10 +64,12 @@ void cpu_loop(CPUARMState *env)
> /* just indicate that signals should be handled asap */
> break;
> case EXCP_UDEF:
> - force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPN, env->pc);
> - break;
> + addr = env->pc;
> + goto do_syndrome;
> case EXCP_PREFETCH_ABORT:
> case EXCP_DATA_ABORT:
> + addr = env->exception.vaddress;
> + do_syndrome:
> ec = syn_get_ec(env->exception.syndrome);
> switch (ec) {
> case EC_DATAABORT:
> @@ -99,10 +102,19 @@ void cpu_loop(CPUARMState *env)
> si_signo = TARGET_SIGBUS;
> si_code = TARGET_BUS_ADRALN;
> break;
> + case EC_UNCATEGORIZED:
> + case EC_BTITRAP:
> + si_signo = TARGET_SIGILL;
> + si_code = TARGET_ILL_ILLOPC;
> + break;
> + case EC_PACFAIL:
> + si_signo = TARGET_SIGILL;
> + si_code = TARGET_ILL_ILLOPN;
> + break;
> default:
> g_assert_not_reached();
> }
> - force_sig_fault(si_signo, si_code, env->exception.vaddress);
> + force_sig_fault(si_signo, si_code, addr);
> break;
> case EXCP_DEBUG:
> case EXCP_BKPT:
It may be worth for lisibility to extract do_syndrome to a proper
function. It's just a recommendation though.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
next prev parent reply other threads:[~2025-07-25 17:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-25 16:51 [PATCH 0/2] linux-user/aarch64: Syndrome fixes and enhancements Richard Henderson
2025-07-25 16:51 ` [PATCH for-10.1 1/2] linux-user/aarch64: Check syndrome for EXCP_UDEF Richard Henderson
2025-07-25 17:11 ` Pierrick Bouvier [this message]
2025-07-25 16:51 ` [PATCH for-10.2? 2/2] linux-user/aarch64: Generate ESR signal records Richard Henderson
2025-07-25 17:13 ` Pierrick Bouvier
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=6f24a5df-d191-4581-a02d-753a98c6bbf1@linaro.org \
--to=pierrick.bouvier@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).