diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2023-11-06 15:00:29 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2023-11-06 15:00:29 +0000 |
commit | 5722fc471296d5f042df4b005a851cc8008df0c9 (patch) | |
tree | a96ea743ebf269b5dde2220a09eb990b96bf7273 /target/arm/tcg | |
parent | 13edcf591e74fd8a0e69f01b8b09f53397562103 (diff) | |
download | qemu-5722fc471296d5f042df4b005a851cc8008df0c9.zip qemu-5722fc471296d5f042df4b005a851cc8008df0c9.tar.gz qemu-5722fc471296d5f042df4b005a851cc8008df0c9.tar.bz2 |
target/arm: Fix A64 LDRA immediate decode
In commit be23a049 in the conversion to decodetree we broke the
decoding of the immediate value in the LDRA instruction. This should
be a 10 bit signed value that is scaled by 8, but in the conversion
we incorrectly ended up scaling it only by 2. Fix the scaling
factor.
Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1970
Fixes: be23a049 ("target/arm: Convert load (pointer auth) insns to decodetree")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20231106113445.1163063-1-peter.maydell@linaro.org
Diffstat (limited to 'target/arm/tcg')
-rw-r--r-- | target/arm/tcg/a64.decode | 2 | ||||
-rw-r--r-- | target/arm/tcg/translate.h | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode index 0cf1147..8a20dce 100644 --- a/target/arm/tcg/a64.decode +++ b/target/arm/tcg/a64.decode @@ -462,7 +462,7 @@ LDAPR sz:2 111 0 00 1 0 1 11111 1100 00 rn:5 rt:5 # Load/store register (pointer authentication) # LDRA immediate is 10 bits signed and scaled, but the bits aren't all contiguous -%ldra_imm 22:s1 12:9 !function=times_2 +%ldra_imm 22:s1 12:9 !function=times_8 LDRA 11 111 0 00 m:1 . 1 ......... w:1 1 rn:5 rt:5 imm=%ldra_imm diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h index 9efe00c..3c3bb34 100644 --- a/target/arm/tcg/translate.h +++ b/target/arm/tcg/translate.h @@ -205,6 +205,11 @@ static inline int times_4(DisasContext *s, int x) return x * 4; } +static inline int times_8(DisasContext *s, int x) +{ + return x * 8; +} + static inline int times_2_plus_1(DisasContext *s, int x) { return x * 2 + 1; |