diff mbox series

tcg/i386: Set P_REXW in tcg_out_addi_ptr

Message ID 20230512171755.1237329-1-richard.henderson@linaro.org
State Superseded
Headers show
Series tcg/i386: Set P_REXW in tcg_out_addi_ptr | expand

Commit Message

Richard Henderson May 12, 2023, 5:17 p.m. UTC
The REXW bit must be set to produce a 64-bit pointer result; the
bit is disabled in 32-bit mode, so we can do this unconditionally.

Fixes: 7d9e1ee424b0 ("tcg/i386: Adjust assert in tcg_out_addi_ptr")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1592
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1642
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/i386/tcg-target.c.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Tokarev May 16, 2023, 8:11 p.m. UTC | #1
12.05.2023 20:17, Richard Henderson wrote:
> The REXW bit must be set to produce a 64-bit pointer result; the
> bit is disabled in 32-bit mode, so we can do this unconditionally.
> 
> Fixes: 7d9e1ee424b0 ("tcg/i386: Adjust assert in tcg_out_addi_ptr")
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1592
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1642

This looks like stable-8.0 material.
Richard Henderson May 16, 2023, 8:18 p.m. UTC | #2
On 5/16/23 13:11, Michael Tokarev wrote:
> 12.05.2023 20:17, Richard Henderson wrote:
>> The REXW bit must be set to produce a 64-bit pointer result; the
>> bit is disabled in 32-bit mode, so we can do this unconditionally.
>>
>> Fixes: 7d9e1ee424b0 ("tcg/i386: Adjust assert in tcg_out_addi_ptr")
>> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1592
>> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1642
> 
> This looks like stable-8.0 material.

Yes indeed, please.

r~
diff mbox series

Patch

diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
index a01bfad773..9fc5592f5d 100644
--- a/tcg/i386/tcg-target.c.inc
+++ b/tcg/i386/tcg-target.c.inc
@@ -1091,7 +1091,7 @@  static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
 {
     /* This function is only used for passing structs by reference. */
     tcg_debug_assert(imm == (int32_t)imm);
-    tcg_out_modrm_offset(s, OPC_LEA, rd, rs, imm);
+    tcg_out_modrm_offset(s, OPC_LEA | P_REXW, rd, rs, imm);
 }
 
 static inline void tcg_out_pushi(TCGContext *s, tcg_target_long val)