diff mbox series

[for-8.0] tcg/ppc: Fix TCG_TARGET_CALL_{ARG, RET}_I128 for ppc32

Message ID 20230408154316.3812709-1-richard.henderson@linaro.org
State New
Headers show
Series [for-8.0] tcg/ppc: Fix TCG_TARGET_CALL_{ARG, RET}_I128 for ppc32 | expand

Commit Message

Richard Henderson April 8, 2023, 3:43 p.m. UTC
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")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/ppc/tcg-target.c.inc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Mark Cave-Ayland April 8, 2023, 7:31 p.m. UTC | #1
On 08/04/2023 16:43, Richard Henderson wrote:

> 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")
> 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 eb9e80ad37..8e6039576a 100644
> --- a/tcg/ppc/tcg-target.c.inc
> +++ b/tcg/ppc/tcg-target.c.inc
> @@ -44,17 +44,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
>   
>   #include "../tcg-pool.c.inc"
>   #include "../tcg-ldst.c.inc"

Excellent - this fixes running qemu-system-ppc with TCG on my Mac Mini G4 :)

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.
diff mbox series

Patch

diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
index eb9e80ad37..8e6039576a 100644
--- a/tcg/ppc/tcg-target.c.inc
+++ b/tcg/ppc/tcg-target.c.inc
@@ -44,17 +44,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
 
 #include "../tcg-pool.c.inc"
 #include "../tcg-ldst.c.inc"