[PATCH 2/6] accel/tcg: Don't use TARGET_LONG_BITS in decode_sleb128

Richard Henderson posted 6 patches 6 months, 2 weeks ago
[PATCH 2/6] accel/tcg: Don't use TARGET_LONG_BITS in decode_sleb128
Posted by Richard Henderson 6 months, 2 weeks ago
When we changed decode_sleb128 from target_long to
int64_t, we failed to adjust the shift limit.

Cc: qemu-stable@nongnu.org
Fixes: c9ad8d27caa ("tcg: Widen gen_insn_data to uint64_t")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 accel/tcg/translate-all.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index fa4998b341..acf32e6c08 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -109,7 +109,7 @@ static int64_t decode_sleb128(const uint8_t **pp)
         val |= (int64_t)(byte & 0x7f) << shift;
         shift += 7;
     } while (byte & 0x80);
-    if (shift < TARGET_LONG_BITS && (byte & 0x40)) {
+    if (shift < 64 && (byte & 0x40)) {
         val |= -(int64_t)1 << shift;
     }
 
-- 
2.43.0
Re: [PATCH 2/6] accel/tcg: Don't use TARGET_LONG_BITS in decode_sleb128
Posted by Philippe Mathieu-Daudé 6 months, 2 weeks ago
On 1/5/25 01:06, Richard Henderson wrote:
> When we changed decode_sleb128 from target_long to
> int64_t, we failed to adjust the shift limit.
> 
> Cc: qemu-stable@nongnu.org
> Fixes: c9ad8d27caa ("tcg: Widen gen_insn_data to uint64_t")
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   accel/tcg/translate-all.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


Re: [PATCH 2/6] accel/tcg: Don't use TARGET_LONG_BITS in decode_sleb128
Posted by Pierrick Bouvier 6 months, 2 weeks ago
On 4/30/25 4:06 PM, Richard Henderson wrote:
> When we changed decode_sleb128 from target_long to
> int64_t, we failed to adjust the shift limit.
> 
> Cc: qemu-stable@nongnu.org
> Fixes: c9ad8d27caa ("tcg: Widen gen_insn_data to uint64_t")
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   accel/tcg/translate-all.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>