* [PATCH] tcg/aarch64: Fix illegal insn from out-of-range shli
@ 2022-06-02 1:14 Richard Henderson
2022-06-02 1:59 ` Joel Stanley
0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2022-06-02 1:14 UTC (permalink / raw)
To: qemu-devel
The masking in tcg_out_shl was incorrect, producing an
illegal instruction, rather than merely unspecified results
for the out-of-range shift.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1051
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/aarch64/tcg-target.c.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
index 61e284bb5c..d997f7922a 100644
--- a/tcg/aarch64/tcg-target.c.inc
+++ b/tcg/aarch64/tcg-target.c.inc
@@ -1261,7 +1261,7 @@ static inline void tcg_out_shl(TCGContext *s, TCGType ext,
{
int bits = ext ? 64 : 32;
int max = bits - 1;
- tcg_out_ubfm(s, ext, rd, rn, bits - (m & max), max - (m & max));
+ tcg_out_ubfm(s, ext, rd, rn, (bits - m) & max, (max - m) & max);
}
static inline void tcg_out_shr(TCGContext *s, TCGType ext,
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tcg/aarch64: Fix illegal insn from out-of-range shli
2022-06-02 1:14 [PATCH] tcg/aarch64: Fix illegal insn from out-of-range shli Richard Henderson
@ 2022-06-02 1:59 ` Joel Stanley
0 siblings, 0 replies; 2+ messages in thread
From: Joel Stanley @ 2022-06-02 1:59 UTC (permalink / raw)
To: Richard Henderson; +Cc: QEMU Developers
On Thu, 2 Jun 2022 at 01:17, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> The masking in tcg_out_shl was incorrect, producing an
> illegal instruction, rather than merely unspecified results
> for the out-of-range shift.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1051
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
I can confirm this fixes the issue I reported, thanks Richard.
Tested-by: Joel Stanley <joel@jms.id.au>
> ---
> tcg/aarch64/tcg-target.c.inc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
> index 61e284bb5c..d997f7922a 100644
> --- a/tcg/aarch64/tcg-target.c.inc
> +++ b/tcg/aarch64/tcg-target.c.inc
> @@ -1261,7 +1261,7 @@ static inline void tcg_out_shl(TCGContext *s, TCGType ext,
> {
> int bits = ext ? 64 : 32;
> int max = bits - 1;
> - tcg_out_ubfm(s, ext, rd, rn, bits - (m & max), max - (m & max));
> + tcg_out_ubfm(s, ext, rd, rn, (bits - m) & max, (max - m) & max);
> }
>
> static inline void tcg_out_shr(TCGContext *s, TCGType ext,
> --
> 2.34.1
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-02 2:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02 1:14 [PATCH] tcg/aarch64: Fix illegal insn from out-of-range shli Richard Henderson
2022-06-02 1:59 ` Joel Stanley
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.