qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/3] tcg patch queue for 8.0
@ 2023-04-10 15:34 Richard Henderson
  2023-04-10 15:34 ` [PULL 1/3] tcg/i386: Adjust assert in tcg_out_addi_ptr Richard Henderson
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Richard Henderson @ 2023-04-10 15:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell

The following changes since commit 08dede07030973c1053868bc64de7e10bfa02ad6:

  Merge tag 'pull-ppc-20230409' of https://github.com/legoater/qemu into staging (2023-04-10 11:47:52 +0100)

are available in the Git repository at:

  https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20230410

for you to fetch changes up to 20861f34e0808bd06a0b7d74f8bd29c29e516ca5:

  tcg/ppc: Fix TCG_TARGET_CALL_{ARG,RET}_I128 for ppc32 (2023-04-10 08:29:24 -0700)

----------------------------------------------------------------
Fix Int128 function call abi for ppc32, mips o32, and _WIN64

----------------------------------------------------------------
Richard Henderson (3):
      tcg/i386: Adjust assert in tcg_out_addi_ptr
      tcg/mips: Fix TCG_TARGET_CALL_RET_I128 for o32 abi
      tcg/ppc: Fix TCG_TARGET_CALL_{ARG,RET}_I128 for ppc32

 tcg/mips/tcg-target.h     | 3 ++-
 tcg/i386/tcg-target.c.inc | 2 +-
 tcg/ppc/tcg-target.c.inc  | 7 ++++---
 3 files changed, 7 insertions(+), 5 deletions(-)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PULL 1/3] tcg/i386: Adjust assert in tcg_out_addi_ptr
  2023-04-10 15:34 [PULL 0/3] tcg patch queue for 8.0 Richard Henderson
@ 2023-04-10 15:34 ` Richard Henderson
  2023-04-10 15:34 ` [PULL 2/3] tcg/mips: Fix TCG_TARGET_CALL_RET_I128 for o32 abi Richard Henderson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2023-04-10 15:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell

We can arrive here on _WIN64 because Int128 is passed by reference.
Change the assert to check that the immediate is in range,
instead of attempting to check the host ABI.

Fixes: 6a6d772e30d ("tcg: Introduce tcg_out_addi_ptr")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1581
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/i386/tcg-target.c.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc
index 4444eb9234..5a151fe64a 100644
--- a/tcg/i386/tcg-target.c.inc
+++ b/tcg/i386/tcg-target.c.inc
@@ -1082,7 +1082,7 @@ static void tcg_out_addi_ptr(TCGContext *s, TCGReg rd, TCGReg rs,
                              tcg_target_long imm)
 {
     /* This function is only used for passing structs by reference. */
-    tcg_debug_assert(TCG_TARGET_REG_BITS == 32);
+    tcg_debug_assert(imm == (int32_t)imm);
     tcg_out_modrm_offset(s, OPC_LEA, rd, rs, imm);
 }
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 2/3] tcg/mips: Fix TCG_TARGET_CALL_RET_I128 for o32 abi
  2023-04-10 15:34 [PULL 0/3] tcg patch queue for 8.0 Richard Henderson
  2023-04-10 15:34 ` [PULL 1/3] tcg/i386: Adjust assert in tcg_out_addi_ptr Richard Henderson
@ 2023-04-10 15:34 ` Richard Henderson
  2023-04-10 15:34 ` [PULL 3/3] tcg/ppc: Fix TCG_TARGET_CALL_{ARG,RET}_I128 for ppc32 Richard Henderson
  2023-04-11  9:20 ` [PULL 0/3] tcg patch queue for 8.0 Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2023-04-10 15:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell

The return is by reference, not in 4 integer registers.

This error resulted in

  qemu-system-i386: tcg/mips/tcg-target.c.inc:140: \
    tcg_target_call_oarg_reg: Assertion `slot >= 0 && slot <= 1' failed.

Fixes: 5427a9a7604 ("tcg: Add TCG_TARGET_CALL_{RET,ARG}_I128")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/mips/tcg-target.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h
index 68b11e4d48..2431fc5353 100644
--- a/tcg/mips/tcg-target.h
+++ b/tcg/mips/tcg-target.h
@@ -84,13 +84,14 @@ typedef enum {
 #if _MIPS_SIM == _ABIO32
 # define TCG_TARGET_CALL_STACK_OFFSET 16
 # define TCG_TARGET_CALL_ARG_I64      TCG_CALL_ARG_EVEN
+# define TCG_TARGET_CALL_RET_I128     TCG_CALL_RET_BY_REF
 #else
 # define TCG_TARGET_CALL_STACK_OFFSET 0
 # define TCG_TARGET_CALL_ARG_I64      TCG_CALL_ARG_NORMAL
+# define TCG_TARGET_CALL_RET_I128     TCG_CALL_RET_NORMAL
 #endif
 #define TCG_TARGET_CALL_ARG_I32       TCG_CALL_ARG_NORMAL
 #define TCG_TARGET_CALL_ARG_I128      TCG_CALL_ARG_EVEN
-#define TCG_TARGET_CALL_RET_I128      TCG_CALL_RET_NORMAL
 
 /* MOVN/MOVZ instructions detection */
 #if (defined(__mips_isa_rev) && (__mips_isa_rev >= 1)) || \
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PULL 3/3] tcg/ppc: Fix TCG_TARGET_CALL_{ARG,RET}_I128 for ppc32
  2023-04-10 15:34 [PULL 0/3] tcg patch queue for 8.0 Richard Henderson
  2023-04-10 15:34 ` [PULL 1/3] tcg/i386: Adjust assert in tcg_out_addi_ptr Richard Henderson
  2023-04-10 15:34 ` [PULL 2/3] tcg/mips: Fix TCG_TARGET_CALL_RET_I128 for o32 abi Richard Henderson
@ 2023-04-10 15:34 ` Richard Henderson
  2023-04-11  9:20 ` [PULL 0/3] tcg patch queue for 8.0 Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2023-04-10 15:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Mark Cave-Ayland

For both _CALL_SYSV and _CALL_DARWIN, return is by reference,
not in 4 integer registers.  For _CALL_SYSV, argument is also
by reference.

This error resulted in

    $ ./qemu-system-i386 -nographic
    qemu-system-i386: tcg/ppc/tcg-target.c.inc:185: \
        tcg_target_call_oarg_reg: Assertion `slot >= 0 && slot <= 1' failed.

Fixes: 5427a9a7604 ("tcg: Add TCG_TARGET_CALL_{RET,ARG}_I128")
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/ppc/tcg-target.c.inc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
index afadf9a1e3..066b49224a 100644
--- a/tcg/ppc/tcg-target.c.inc
+++ b/tcg/ppc/tcg-target.c.inc
@@ -46,17 +46,18 @@
 
 #if TCG_TARGET_REG_BITS == 64
 # define TCG_TARGET_CALL_ARG_I32   TCG_CALL_ARG_EXTEND
+# define TCG_TARGET_CALL_RET_I128  TCG_CALL_RET_NORMAL
 #else
 # define TCG_TARGET_CALL_ARG_I32   TCG_CALL_ARG_NORMAL
+# define TCG_TARGET_CALL_RET_I128  TCG_CALL_RET_BY_REF
 #endif
 #ifdef _CALL_SYSV
 # define TCG_TARGET_CALL_ARG_I64   TCG_CALL_ARG_EVEN
+# define TCG_TARGET_CALL_ARG_I128  TCG_CALL_ARG_BY_REF
 #else
 # define TCG_TARGET_CALL_ARG_I64   TCG_CALL_ARG_NORMAL
+# define TCG_TARGET_CALL_ARG_I128  TCG_CALL_ARG_NORMAL
 #endif
-/* Note sysv arg alignment applies only to 2-word types, not more. */
-#define TCG_TARGET_CALL_ARG_I128   TCG_CALL_ARG_NORMAL
-#define TCG_TARGET_CALL_RET_I128   TCG_CALL_RET_NORMAL
 
 /* For some memory operations, we need a scratch that isn't R0.  For the AIX
    calling convention, we can re-use the TOC register since we'll be reloading
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PULL 0/3] tcg patch queue for 8.0
  2023-04-10 15:34 [PULL 0/3] tcg patch queue for 8.0 Richard Henderson
                   ` (2 preceding siblings ...)
  2023-04-10 15:34 ` [PULL 3/3] tcg/ppc: Fix TCG_TARGET_CALL_{ARG,RET}_I128 for ppc32 Richard Henderson
@ 2023-04-11  9:20 ` Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2023-04-11  9:20 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel

On Mon, 10 Apr 2023 at 16:34, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> The following changes since commit 08dede07030973c1053868bc64de7e10bfa02ad6:
>
>   Merge tag 'pull-ppc-20230409' of https://github.com/legoater/qemu into staging (2023-04-10 11:47:52 +0100)
>
> are available in the Git repository at:
>
>   https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20230410
>
> for you to fetch changes up to 20861f34e0808bd06a0b7d74f8bd29c29e516ca5:
>
>   tcg/ppc: Fix TCG_TARGET_CALL_{ARG,RET}_I128 for ppc32 (2023-04-10 08:29:24 -0700)
>
> ----------------------------------------------------------------
> Fix Int128 function call abi for ppc32, mips o32, and _WIN64
>
> ----------------------------------------------------------------
> Richard Henderson (3):
>       tcg/i386: Adjust assert in tcg_out_addi_ptr
>       tcg/mips: Fix TCG_TARGET_CALL_RET_I128 for o32 abi
>       tcg/ppc: Fix TCG_TARGET_CALL_{ARG,RET}_I128 for ppc32


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/8.0
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-11  9:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-10 15:34 [PULL 0/3] tcg patch queue for 8.0 Richard Henderson
2023-04-10 15:34 ` [PULL 1/3] tcg/i386: Adjust assert in tcg_out_addi_ptr Richard Henderson
2023-04-10 15:34 ` [PULL 2/3] tcg/mips: Fix TCG_TARGET_CALL_RET_I128 for o32 abi Richard Henderson
2023-04-10 15:34 ` [PULL 3/3] tcg/ppc: Fix TCG_TARGET_CALL_{ARG,RET}_I128 for ppc32 Richard Henderson
2023-04-11  9:20 ` [PULL 0/3] tcg patch queue for 8.0 Peter Maydell

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).