diff mbox series

[2/4] linux-user/mips64: Support o32 ABI syscalls

Message ID 20201119161710.1985083-3-f4bug@amsat.org
State New
Headers show
Series linux-user: Support o32 ABI with 64-bit MIPS CPUs | expand

Commit Message

Philippe Mathieu-Daudé Nov. 19, 2020, 4:17 p.m. UTC
o32 ABI syscalls start at offset 4000.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 linux-user/mips64/syscall_nr.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Richard Henderson Nov. 19, 2020, 11:08 p.m. UTC | #1
On 11/19/20 8:17 AM, Philippe Mathieu-Daudé wrote:
> +#if defined(TARGET_ABI_MIPSO32)
> +#define TARGET_SYSCALL_OFFSET 4000
> +#include "syscall_o32_nr.h"

Where does this get built?


r~
Richard Henderson Nov. 19, 2020, 11:09 p.m. UTC | #2
On 11/19/20 3:08 PM, Richard Henderson wrote:
> On 11/19/20 8:17 AM, Philippe Mathieu-Daudé wrote:
>> +#if defined(TARGET_ABI_MIPSO32)
>> +#define TARGET_SYSCALL_OFFSET 4000
>> +#include "syscall_o32_nr.h"
> 
> Where does this get built?

Ah, I see, next patch.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
Laurent Vivier Dec. 17, 2020, 10:40 a.m. UTC | #3
Le 19/11/2020 à 17:17, Philippe Mathieu-Daudé a écrit :
> o32 ABI syscalls start at offset 4000.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  linux-user/mips64/syscall_nr.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/mips64/syscall_nr.h b/linux-user/mips64/syscall_nr.h
> index 672f2fa51cb..6579421fa63 100644
> --- a/linux-user/mips64/syscall_nr.h
> +++ b/linux-user/mips64/syscall_nr.h
> @@ -1,4 +1,7 @@
> -#ifdef TARGET_ABI_MIPSN32
> +#if defined(TARGET_ABI_MIPSO32)
> +#define TARGET_SYSCALL_OFFSET 4000

The value of the offset is hardcoded in linux-user/mips/meson.build, so either you remove
TARGET_SYSCALL_OFFSET here or you update meson.build to use it.

> +#include "syscall_o32_nr.h"
> +#elif defined(TARGET_ABI_MIPSN32)
>  #define TARGET_SYSCALL_OFFSET 6000
>  #include "syscall_n32_nr.h"
>  #else
> 

Thanks,
Laurent
Philippe Mathieu-Daudé Dec. 17, 2020, 4:10 p.m. UTC | #4
On 12/17/20 11:40 AM, Laurent Vivier wrote:
> Le 19/11/2020 à 17:17, Philippe Mathieu-Daudé a écrit :
>> o32 ABI syscalls start at offset 4000.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  linux-user/mips64/syscall_nr.h | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/linux-user/mips64/syscall_nr.h b/linux-user/mips64/syscall_nr.h
>> index 672f2fa51cb..6579421fa63 100644
>> --- a/linux-user/mips64/syscall_nr.h
>> +++ b/linux-user/mips64/syscall_nr.h
>> @@ -1,4 +1,7 @@
>> -#ifdef TARGET_ABI_MIPSN32
>> +#if defined(TARGET_ABI_MIPSO32)
>> +#define TARGET_SYSCALL_OFFSET 4000
> 
> The value of the offset is hardcoded in linux-user/mips/meson.build, so either you remove
> TARGET_SYSCALL_OFFSET here or you update meson.build to use it.

I don't understand what this Meson rule does, as this
doesn't work without this patch...

You can download PS2 64-bit O32 binaries from 2002 (before
the official MIPS TLS ABI) there:
https://sourceforge.net/projects/kernelloader/files/

> 
>> +#include "syscall_o32_nr.h"
>> +#elif defined(TARGET_ABI_MIPSN32)
>>  #define TARGET_SYSCALL_OFFSET 6000
>>  #include "syscall_n32_nr.h"
>>  #else
>>
> 
> Thanks,
> Laurent
>
Fredrik Noring Dec. 17, 2020, 5:20 p.m. UTC | #5
On Thu, Dec 17, 2020 at 05:10:24PM +0100, Philippe Mathieu-Daudé wrote:
> On 12/17/20 11:40 AM, Laurent Vivier wrote:
> > Le 19/11/2020 à 17:17, Philippe Mathieu-Daudé a écrit :
> >> o32 ABI syscalls start at offset 4000.
> >>
> >> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> >> ---
> >>  linux-user/mips64/syscall_nr.h | 5 ++++-
> >>  1 file changed, 4 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/linux-user/mips64/syscall_nr.h b/linux-user/mips64/syscall_nr.h
> >> index 672f2fa51cb..6579421fa63 100644
> >> --- a/linux-user/mips64/syscall_nr.h
> >> +++ b/linux-user/mips64/syscall_nr.h
> >> @@ -1,4 +1,7 @@
> >> -#ifdef TARGET_ABI_MIPSN32
> >> +#if defined(TARGET_ABI_MIPSO32)
> >> +#define TARGET_SYSCALL_OFFSET 4000
> > 
> > The value of the offset is hardcoded in linux-user/mips/meson.build, so either you remove
> > TARGET_SYSCALL_OFFSET here or you update meson.build to use it.
> 
> I don't understand what this Meson rule does, as this
> doesn't work without this patch...
> 
> You can download PS2 64-bit O32 binaries from 2002 (before
> the official MIPS TLS ABI) there:
> https://sourceforge.net/projects/kernelloader/files/

These look rather like 128 bits, as there are R5900 MMIs. For instance,
one can find LQ, SQ, PEXTLB, PEXTLW and so on in /lib/ld.so in
ps2linux_live_v5_pal_netsurf_usb.7z.

There may be other surprises. R5900 Linux 2.x kernels are not IEEE 754
compatible, as opposed to both 5.x kernels and QEMU, for instance.

I would suggest compiling tests with a recent GCC.

Fredrik
Laurent Vivier Dec. 17, 2020, 8:14 p.m. UTC | #6
Le 17/12/2020 à 17:10, Philippe Mathieu-Daudé a écrit :
> On 12/17/20 11:40 AM, Laurent Vivier wrote:
>> Le 19/11/2020 à 17:17, Philippe Mathieu-Daudé a écrit :
>>> o32 ABI syscalls start at offset 4000.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> ---
>>>  linux-user/mips64/syscall_nr.h | 5 ++++-
>>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/linux-user/mips64/syscall_nr.h b/linux-user/mips64/syscall_nr.h
>>> index 672f2fa51cb..6579421fa63 100644
>>> --- a/linux-user/mips64/syscall_nr.h
>>> +++ b/linux-user/mips64/syscall_nr.h
>>> @@ -1,4 +1,7 @@
>>> -#ifdef TARGET_ABI_MIPSN32
>>> +#if defined(TARGET_ABI_MIPSO32)
>>> +#define TARGET_SYSCALL_OFFSET 4000
>>
>> The value of the offset is hardcoded in linux-user/mips/meson.build, so either you remove
>> TARGET_SYSCALL_OFFSET here or you update meson.build to use it.
> 
> I don't understand what this Meson rule does, as this
> doesn't work without this patch...

Yes, you're right, this is hardcoded in mips directory, not in mips64 directory.

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Laurent Vivier Feb. 11, 2021, 9:33 p.m. UTC | #7
Le 19/11/2020 à 17:17, Philippe Mathieu-Daudé a écrit :
> o32 ABI syscalls start at offset 4000.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  linux-user/mips64/syscall_nr.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/mips64/syscall_nr.h b/linux-user/mips64/syscall_nr.h
> index 672f2fa51cb..6579421fa63 100644
> --- a/linux-user/mips64/syscall_nr.h
> +++ b/linux-user/mips64/syscall_nr.h
> @@ -1,4 +1,7 @@
> -#ifdef TARGET_ABI_MIPSN32
> +#if defined(TARGET_ABI_MIPSO32)
> +#define TARGET_SYSCALL_OFFSET 4000
> +#include "syscall_o32_nr.h"
> +#elif defined(TARGET_ABI_MIPSN32)
>  #define TARGET_SYSCALL_OFFSET 6000
>  #include "syscall_n32_nr.h"
>  #else
> 

Applied to my linux-user-for-6.0 branch.

Thanks,
Laurent
diff mbox series

Patch

diff --git a/linux-user/mips64/syscall_nr.h b/linux-user/mips64/syscall_nr.h
index 672f2fa51cb..6579421fa63 100644
--- a/linux-user/mips64/syscall_nr.h
+++ b/linux-user/mips64/syscall_nr.h
@@ -1,4 +1,7 @@ 
-#ifdef TARGET_ABI_MIPSN32
+#if defined(TARGET_ABI_MIPSO32)
+#define TARGET_SYSCALL_OFFSET 4000
+#include "syscall_o32_nr.h"
+#elif defined(TARGET_ABI_MIPSN32)
 #define TARGET_SYSCALL_OFFSET 6000
 #include "syscall_n32_nr.h"
 #else