diff mbox

[v6,5/7] linux-user: Fix certain argument alignment cases for Mips64

Message ID 20160916111422.109959-6-aleksandar.markovic@rt-rk.com (mailing list archive)
State New, archived
Headers show

Commit Message

Aleksandar Markovic Sept. 16, 2016, 11:14 a.m. UTC
From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

The function that is changed in this patch is supposed to indicate that
there was certaing argument rearangement related to 64-bit arguments on
32-bit platforms. The background on such rearangements can be found,
for example, in the man page for syscall(2).

However, for 64-bit Mips architectures there is no such rearangement,
and this patch reflects it.

Signed-off-by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com>
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/syscall.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Laurent Vivier Sept. 16, 2016, 7:29 p.m. UTC | #1
Le 16/09/2016 à 13:14, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> 
> The function that is changed in this patch is supposed to indicate that
> there was certaing argument rearangement related to 64-bit arguments on
> 32-bit platforms. The background on such rearangements can be found,
> for example, in the man page for syscall(2).
> 
> However, for 64-bit Mips architectures there is no such rearangement,
> and this patch reflects it.
> 
> Signed-off-by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com>
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> ---
>  linux-user/syscall.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index ca06943..ee23b29 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -620,7 +620,14 @@ static inline int regpairs_aligned(void *cpu_env) {
>      return ((((CPUARMState *)cpu_env)->eabi) == 1) ;
>  }
>  #elif defined(TARGET_MIPS)
> -static inline int regpairs_aligned(void *cpu_env) { return 1; }
> +static inline int regpairs_aligned(void *cpu_env)
> +{
> +#if TARGET_ABI_BITS == 32
> +    return 1;
> +#else
> +    return 0;
> +#endif
> +}
>  #elif defined(TARGET_PPC) && !defined(TARGET_PPC64)
>  /* SysV AVI for PPC32 expects 64bit parameters to be passed on odd/even pairs
>   * of registers which translates to the same as ARM/MIPS, because we start with
> 

To mimic PPC, would be cleaner with:

...
#elif defined(TARGET_MIPS) && TARGET_ABI_BITS == 32
static inline int regpairs_aligned(void *cpu_env) { return 1; }
#else
...

Laurent
Aleksandar Markovic Sept. 19, 2016, 8:33 a.m. UTC | #2
So true. In v7, I am going to use the style that you suggested.
diff mbox

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ca06943..ee23b29 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -620,7 +620,14 @@  static inline int regpairs_aligned(void *cpu_env) {
     return ((((CPUARMState *)cpu_env)->eabi) == 1) ;
 }
 #elif defined(TARGET_MIPS)
-static inline int regpairs_aligned(void *cpu_env) { return 1; }
+static inline int regpairs_aligned(void *cpu_env)
+{
+#if TARGET_ABI_BITS == 32
+    return 1;
+#else
+    return 0;
+#endif
+}
 #elif defined(TARGET_PPC) && !defined(TARGET_PPC64)
 /* SysV AVI for PPC32 expects 64bit parameters to be passed on odd/even pairs
  * of registers which translates to the same as ARM/MIPS, because we start with