Skip to contentSkip to conversation

linux-user: Support o32 ABI with 64-bit MIPS CPUs

PATCH Applied Philippe Mathieu-Daudé 6 participants 23 messages Nov 19, 2020 – Feb 11, 2021 exec and binfmt

lore
Share & tools
lore
#0 lore raw

cover linux-user: Support o32 ABI with 64-bit MIPS CPUs

This series allow building linux-user emulator to run ELF binaries built for the MIPS o32 ABI on 64-bit CPUs (binaries produced by Sony Linux Toolkit for Playstation 2 for the R5900 CPU).

The new QEMU binary is named 'qemu-mips64o32'.

The binfmt config isn't correct, as it matches mipsel/mipsn32el. I missed to understand how mipsel (o32) and mipsn32el (n32) are differenciated.

Based-on: <[email protected]>

Philippe Mathieu-Daudé (4):
linux-user/mips64: Restore setup_frame() for o32 ABI linux-user/mips64: Support o32 ABI syscalls
default-configs: Support o32 ABI with 64-bit MIPS CPUs RFC qemu-binfmt-conf.sh: Add MIPS64 o32 ABI

 docs/user/main.rst                                 | 3 +++
 default-configs/targets/mips64o32el-linux-user.mak | 7 +++++++
 linux-user/mips64/syscall_nr.h                     | 5 ++++-
 linux-user/mips64/target_signal.h                  | 4 ++++
 scripts/qemu-binfmt-conf.sh                        | 4 ++++
 5 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 default-configs/targets/mips64o32el-linux-user.mak
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/4 linux-user/mips64: Restore setup_frame() for o32 ABI

64-bit MIPS targets lost setup_frame() during the refactor in commit 8949bef18b9. Restore it declaring TARGET_ARCH_HAS_SETUP_FRAME, to be able to build the o32 ABI target.

Fixes 8949bef18b9 ("linux-user: move mips/mips64 signal.c parts to mips directory")
---
 linux-user/mips64/target_signal.h | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mips64/target_signal.h +4 -0
index 799f7a668cd..f1f0ed7f706 100644
@@ -67,4 +67,8 @@ typedef struct target_sigaltstack {
 #define TARGET_MINSIGSTKSZ    2048
 #define TARGET_SIGSTKSZ       8192
 
+#if defined(TARGET_ABI_MIPSO32)
+/* compare linux/arch/mips/kernel/signal.c:setup_frame() */
+#define TARGET_ARCH_HAS_SETUP_FRAME
+#endif
 #endif /* MIPS64_TARGET_SIGNAL_H */
Signature · 1 line
2.26.2
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] linux-user/mips64: Restore setup_frame() for o32 ABI

Quoted 9 lines · Philippe Mathieu-Daudé

64-bit MIPS targets lost setup_frame() during the refactor in commit 8949bef18b9. Restore it declaring TARGET_ARCH_HAS_SETUP_FRAME, to be able to build the o32 ABI target.

Fixes 8949bef18b9 ("linux-user: move mips/mips64 signal.c parts to mips directory")
---
 linux-user/mips64/target_signal.h | 4 ++++
 1 file changed, 4 insertions(+)

r~

Reviewed-by on v1 1/4
#3 lore raw

Re: [PATCH 1/4] linux-user/mips64: Restore setup_frame() for o32 ABI

In reply to Philippe Mathieu-Daudé

Le 19/11/2020 à 17:17, Philippe Mathieu-Daudé a écrit :

Quoted 16 lines

64-bit MIPS targets lost setup_frame() during the refactor in commit 8949bef18b9. Restore it declaring TARGET_ARCH_HAS_SETUP_FRAME, to be able to build the o32 ABI target.

Fixes 8949bef18b9 ("linux-user: move mips/mips64 signal.c parts to mips directory")
---
 linux-user/mips64/target_signal.h | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mips64/target_signal.h +0 -0
index 799f7a668cd..f1f0ed7f706 100644

linux-user/mips64/target_signal.h typedef struct target_sigaltstack { · line 74

Quoted 8 lines
linux-user/mips64/target_signal.h +4 -0
@@ -67,4 +67,8 @@ typedef struct target_sigaltstack {
 #define TARGET_MINSIGSTKSZ    2048
 #define TARGET_SIGSTKSZ       8192
 
+#if defined(TARGET_ABI_MIPSO32)
+/* compare linux/arch/mips/kernel/signal.c:setup_frame() */
+#define TARGET_ARCH_HAS_SETUP_FRAME
+#endif
 #endif /* MIPS64_TARGET_SIGNAL_H */
#4 lore raw

Re: [PATCH 1/4] linux-user/mips64: Restore setup_frame() for o32 ABI

In reply to Philippe Mathieu-Daudé

Le 19/11/2020 à 17:17, Philippe Mathieu-Daudé a écrit :

Quoted 16 lines

64-bit MIPS targets lost setup_frame() during the refactor in commit 8949bef18b9. Restore it declaring TARGET_ARCH_HAS_SETUP_FRAME, to be able to build the o32 ABI target.

Fixes 8949bef18b9 ("linux-user: move mips/mips64 signal.c parts to mips directory")
---
 linux-user/mips64/target_signal.h | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mips64/target_signal.h +0 -0
index 799f7a668cd..f1f0ed7f706 100644

linux-user/mips64/target_signal.h typedef struct target_sigaltstack { · line 74

Quoted 8 lines
linux-user/mips64/target_signal.h +4 -0
@@ -67,4 +67,8 @@ typedef struct target_sigaltstack {
 #define TARGET_MINSIGSTKSZ    2048
 #define TARGET_SIGSTKSZ       8192
 
+#if defined(TARGET_ABI_MIPSO32)
+/* compare linux/arch/mips/kernel/signal.c:setup_frame() */
+#define TARGET_ARCH_HAS_SETUP_FRAME
+#endif
 #endif /* MIPS64_TARGET_SIGNAL_H */

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

Thanks,
Laurent

#5 lore raw

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

In reply to Philippe Mathieu-Daudé

o32 ABI syscalls start at offset 4000.

---
 linux-user/mips64/syscall_nr.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
linux-user/mips64/syscall_nr.h +4 -1
index 672f2fa51cb..6579421fa63 100644
@@ -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
Signature · 1 line
2.26.2
#6 lore raw

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

linux-user/mips64/syscall_nr.h line 3

Quoted 3 lines · Philippe Mathieu-Daudé
linux-user/mips64/syscall_nr.h +3 -0
+#if defined(TARGET_ABI_MIPSO32)
+#define TARGET_SYSCALL_OFFSET 4000
+#include "syscall_o32_nr.h"

Where does this get built?

r~

Reviewed-by
#7 lore raw

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

Quoted 6 lines · Richard Henderson

linux-user/mips64/syscall_nr.h line 3

Quoted 3 lines · Philippe Mathieu-Daudé
linux-user/mips64/syscall_nr.h +3 -0
+#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.

r~

#8 lore raw

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

In reply to Philippe Mathieu-Daudé

Le 19/11/2020 à 17:17, Philippe Mathieu-Daudé a écrit :

Quoted 12 lines

o32 ABI syscalls start at offset 4000.

---
 linux-user/mips64/syscall_nr.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
linux-user/mips64/syscall_nr.h +0 -0
index 672f2fa51cb..6579421fa63 100644

linux-user/mips64/syscall_nr.h line 2

Quoted 3 lines
linux-user/mips64/syscall_nr.h +2 -1
@@ -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.

linux-user/mips64/syscall_nr.h line 7

Quoted 6 lines
linux-user/mips64/syscall_nr.h +2 -0
+#include "syscall_o32_nr.h"
+#elif defined(TARGET_ABI_MIPSN32)
 #define TARGET_SYSCALL_OFFSET 6000
 #include "syscall_n32_nr.h"
 #else

Thanks,
Laurent

#9 lore raw

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

Quoted 8 lines · Laurent Vivier

Le 19/11/2020 à 17:17, Philippe Mathieu-Daudé a écrit :

Quoted 7 lines

o32 ABI syscalls start at offset 4000.

---
 linux-user/mips64/syscall_nr.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 11 lines

linux-user/mips64/syscall_nr.h line 2

Quoted 8 lines
linux-user/mips64/syscall_nr.h +2 -1
index 672f2fa51cb..6579421fa63 100644
@@ -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/

Quoted 11 lines

linux-user/mips64/syscall_nr.h line 7

Quoted 7 lines
linux-user/mips64/syscall_nr.h +2 -0
+#include "syscall_o32_nr.h"
+#elif defined(TARGET_ABI_MIPSN32)
 #define TARGET_SYSCALL_OFFSET 6000
 #include "syscall_n32_nr.h"
 #else

Thanks,
Laurent

#10 lore raw

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

Quoted 21 lines · Philippe Mathieu-Daudé
Quoted 8 lines · Laurent Vivier

Le 19/11/2020 à 17:17, Philippe Mathieu-Daudé a écrit :

Quoted 7 lines

o32 ABI syscalls start at offset 4000.

---
 linux-user/mips64/syscall_nr.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 11 lines

linux-user/mips64/syscall_nr.h line 2

Quoted 8 lines
linux-user/mips64/syscall_nr.h +2 -1
index 672f2fa51cb..6579421fa63 100644
@@ -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.

Quoted 6 lines

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

Reviewed-by
#11 lore raw

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

In reply to Philippe Mathieu-Daudé

Le 17/12/2020 à 17:10, Philippe Mathieu-Daudé a écrit :

Quoted 21 lines · Laurent Vivier
Quoted 8 lines

Le 19/11/2020 à 17:17, Philippe Mathieu-Daudé a écrit :

Quoted 7 lines

o32 ABI syscalls start at offset 4000.

---
 linux-user/mips64/syscall_nr.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 11 lines

linux-user/mips64/syscall_nr.h line 2

Quoted 8 lines
linux-user/mips64/syscall_nr.h +2 -1
index 672f2fa51cb..6579421fa63 100644
@@ -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.

Quoted 2 lines

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.

#12 lore raw

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

In reply to Philippe Mathieu-Daudé

Le 19/11/2020 à 17:17, Philippe Mathieu-Daudé a écrit :

Quoted 13 lines

o32 ABI syscalls start at offset 4000.

---
 linux-user/mips64/syscall_nr.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
linux-user/mips64/syscall_nr.h +0 -0
index 672f2fa51cb..6579421fa63 100644

linux-user/mips64/syscall_nr.h line 7

Quoted 8 lines
linux-user/mips64/syscall_nr.h +4 -1
@@ -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

#13 lore raw

PATCH 3/4 default-configs: Support o32 ABI with 64-bit MIPS CPUs

In reply to Philippe Mathieu-Daudé

MIPS o32 ABI on 64-bit CPUs looks like a ILP32-on-64bit data model, allowing 64-bit arithmetic and data movement instructions.

This is the default ABI used by the "Sony Linux Toolkit for Playstation 2".

As we don't know big-endian uses, we only introduce the little-endian variant.

---
Cc: Fredrik Noring <[email protected]>
Cc: Maciej W. Rozycki <[email protected]>
Cc: Jürgen Urban <[email protected]>

Cc from https://lists.debian.org/debian-mips/2015/05/msg00014.html:
Cc: Mathieu Malaterre <[email protected]>
Cc: James Cowgill <[email protected]>
Cc: YunQiang Su <[email protected]>
Cc: David Daney <[email protected]>

---
 docs/user/main.rst                                 | 3 +++
 default-configs/targets/mips64o32el-linux-user.mak | 7 +++++++
 2 files changed, 10 insertions(+)
 create mode 100644 default-configs/targets/mips64o32el-linux-user.mak
docs/user/main.rst +3 -0
index 8dfe232a3af..2cef1320ff3 100644
@@ -211,6 +211,9 @@ Other binaries
 
    * ``qemu-mipsel`` executes 32-bit little endian MIPS binaries (MIPS O32 ABI).
 
+   * ``qemu-mips64o32el`` executes 64-bit little endian MIPS binaries (MIPS O32
+     ABI).
+
    * ``qemu-mips64`` executes 64-bit big endian MIPS binaries (MIPS N64 ABI).
 
    * ``qemu-mips64el`` executes 64-bit little endian MIPS binaries (MIPS N64
default-configs/targets/mips64o32el-linux-user.mak new file +7 -0
new file mode 100644
index 00000000000..ecd57ff949f
@@ -0,0 +1,7 @@
+TARGET_ARCH=mips64
+TARGET_BASE_ARCH=mips
+TARGET_ABI_MIPSO32=y
+TARGET_ABI32=y
+TARGET_SYSTBL_ABI=o32
+TARGET_SYSTBL=../mips/syscall_o32.tbl
+TARGET_ALIGNED_ONLY=y
Signature · 1 line
2.26.2
#14 lore raw

Re: [PATCH 3/4] default-configs: Support o32 ABI with 64-bit MIPS CPUs

Quoted 5 lines · Philippe Mathieu-Daudé

MIPS o32 ABI on 64-bit CPUs looks like a ILP32-on-64bit data model, allowing 64-bit arithmetic and data movement instructions.

This is the default ABI used by the "Sony Linux Toolkit for Playstation 2".

Please don't, not at least with a generic configuration (i.e. make it
unambiguous that this is R5900-specific). This only works with R5900 because it does not implement the MIPS ISA correctly (e.g. see what $ra is set to with JAL/JALR/etc. in the kernel mode), and it is not supported by the standard Linux ABI. Use n32 instead, which has the same functionality and is standard (and is also a better ABI in terms of performance).

You'd probably need to implement all the R5900 addressing quirks for your
proposed hack to match hardware, or otherwise you'll end up with emulation that creates its own reality.

Maciej

#15 lore raw

Re: [PATCH 3/4] default-configs: Support o32 ABI with 64-bit MIPS CPUs

Hi Maciej,

Quoted 8 lines · Maciej W. Rozycki
Quoted 5 lines · Philippe Mathieu-Daudé

MIPS o32 ABI on 64-bit CPUs looks like a ILP32-on-64bit data model, allowing 64-bit arithmetic and data movement instructions.

This is the default ABI used by the "Sony Linux Toolkit for Playstation 2".

Quoted 6 lines

Please don't, not at least with a generic configuration (i.e. make it
unambiguous that this is R5900-specific). This only works with R5900 because it does not implement the MIPS ISA correctly (e.g. see what $ra is set to with JAL/JALR/etc. in the kernel mode), and it is not supported by the standard Linux ABI. Use n32 instead, which has the same functionality and is standard (and is also a better ABI in terms of performance).

I think there are 2 different interests with the R5900. Fredrik sent a series to run recent userland/kernel on a PS2. For QEMU, it would be easier if these uses the n32 ABI indeed.

This series allows me to run unmodified binaries from the PS2 (built maybe 20 years ago, apparently for a kernel 2.2).

Quoted 3 lines

You'd probably need to implement all the R5900 addressing quirks for your
proposed hack to match hardware, or otherwise you'll end up with emulation that creates its own reality.

QEMU doesn't model well non-MIPS32 ISA, so the R5900 needs work indeed.

Laurent, maybe instead of 'mips64o32el-linux-user' we can call this target 'r5900o32-linux-user', 'ps2-linux-user' or even 'r5900-ps2-user' as Maciej said "it is not supported by the standard Linux ABI."

Also I'll see to mark it deprecated so it isn't built by default.

Thanks Maciej for your interest,

Phil.

#16 lore raw

Re: [PATCH 3/4] default-configs: Support o32 ABI with 64-bit MIPS CPUs

Hi Philippe,

[ My apologies for the late reply, somehow this thread was treated as spam. ]

Quoted 18 lines · Philippe Mathieu-Daudé

Hi Maciej,

Quoted 8 lines · Maciej W. Rozycki
Quoted 5 lines · Philippe Mathieu-Daudé

MIPS o32 ABI on 64-bit CPUs looks like a ILP32-on-64bit data model, allowing 64-bit arithmetic and data movement instructions.

This is the default ABI used by the "Sony Linux Toolkit for Playstation 2".

Quoted 6 lines

Please don't, not at least with a generic configuration (i.e. make it
unambiguous that this is R5900-specific). This only works with R5900 because it does not implement the MIPS ISA correctly (e.g. see what $ra is set to with JAL/JALR/etc. in the kernel mode), and it is not supported by the standard Linux ABI. Use n32 instead, which has the same functionality and is standard (and is also a better ABI in terms of performance).

Quoted 3 lines

I think there are 2 different interests with the R5900. Fredrik sent a series to run recent userland/kernel on a PS2. For QEMU, it would be easier if these uses the n32 ABI indeed.

Modern (4.x and 5.x) R5900 Linux kernels only support o32, due to R5900 complications with n32. The plan is to reintroduce n32 once o32 is usable. The R5900 MMI set is another complication for both ABIs (not mentioning its vector coprocessors).

Quoted 2 lines

This series allows me to run unmodified binaries from the PS2 (built maybe 20 years ago, apparently for a kernel 2.2).

Programs in the Debian Black Rhino distribution? I have the impression that there are at least some R5900 specific instructions in some of them, no?

The 2.x R5900 Linux kernel does (to some degree) support both o32 and n32, but the implementation had to be reworked (almost entirely) to update it through Linux 3.x, 4.x and 5.x, and n32 was provisionally dropped to simplify this. The GNU C library will have to be updated for n32 too.

I'm presently implementing device drivers, that involve the companion MIPS 3000A I/O processor.

Quoted 9 lines
Quoted 3 lines

You'd probably need to implement all the R5900 addressing quirks for your
proposed hack to match hardware, or otherwise you'll end up with emulation that creates its own reality.

QEMU doesn't model well non-MIPS32 ISA, so the R5900 needs work indeed.

Laurent, maybe instead of 'mips64o32el-linux-user' we can call this target 'r5900o32-linux-user', 'ps2-linux-user' or even 'r5900-ps2-user' as Maciej said "it is not supported by the standard Linux ABI."

Would "ps2" in the name imply emulating all PlayStation 2 hardware, as opposed to "r5900" that is only its main processor? There are also two interesting vector coprocessors (VPU0 and VPU1) to go with it. :)

Quoted 1 line

Also I'll see to mark it deprecated so it isn't built by default.

Presently o32 is the main use case for modern 5.x R5900 Linux, and so regardless of deprecation I have a copy of QEMU supporting it here:

https://github.com/frno7/qemu

We are building modern Gentoo Linux for the R5900, as described in

https://github.com/frno7/linux/issues/33

where R5900 QEMU having o32 is a requirement.

Fredrik

#17 lore raw

Re: [PATCH 3/4] default-configs: Support o32 ABI with 64-bit MIPS CPUs

In reply to Maciej W. Rozycki
Quoted 15 lines · Maciej W. Rozycki
Quoted 5 lines · Philippe Mathieu-Daudé

MIPS o32 ABI on 64-bit CPUs looks like a ILP32-on-64bit data model, allowing 64-bit arithmetic and data movement instructions.

This is the default ABI used by the "Sony Linux Toolkit for Playstation 2".

Please don't, not at least with a generic configuration (i.e. make it
unambiguous that this is R5900-specific). This only works with R5900 because it does not implement the MIPS ISA correctly (e.g. see what $ra is set to with JAL/JALR/etc. in the kernel mode), and it is not supported by the standard Linux ABI. Use n32 instead, which has the same functionality and is standard (and is also a better ABI in terms of performance).

Quoted 3 lines

You'd probably need to implement all the R5900 addressing quirks for your
proposed hack to match hardware, or otherwise you'll end up with emulation that creates its own reality.

I agree. Modern Linux kernel and GCC are important too. It seems both o32 and n32, with quirks, are generally accepted, but R5900 MMIs and other special features are less clear:

For example, given the fact that the 128-bit MMIs are unconditionally executable on R5900 hardware, a user may be forgiven to believe that they always work. But unless the Linux kernel restores 128-bit registers in its operating mode switches, which could be o32, there will be silent data corruption (and ensuing frustration).

(For this reason I favour full register restores in all operating modes.)

Fredrik

#18 lore raw

PATCH 4/4 RFC qemu-binfmt-conf.sh: Add MIPS64 o32 ABI

In reply to Philippe Mathieu-Daudé

... but this is wrong as the same header matches MIPS32 o32 ELFs...

---
checkpatch errors:

ERROR: line over 90 characters
#9: FILE: scripts/qemu-binfmt-conf.sh:71:
+mips64o32el_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00'
ERROR: line over 90 characters
#10: FILE: scripts/qemu-binfmt-conf.sh:72:
+mips64o32el_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'

---
 scripts/qemu-binfmt-conf.sh | 4 ++++
 1 file changed, 4 insertions(+)
scripts/qemu-binfmt-conf.sh +4 -0
index 9f1580a91c7..ee86345ff8a 100755
@@ -68,6 +68,10 @@ mipsel_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x0
 mipsel_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
 mipsel_family=mips
 
+mips64o32el_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00'
+mips64o32el_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
+mips64o32el_family=mips
+
 mipsn32_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08'
 mipsn32_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
 mipsn32_family=mips
Signature · 1 line
2.26.2
#20 lore raw
In reply to Philippe Mathieu-Daudé
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [PATCH 0/4] linux-user: Support o32 ABI with 64-bit MIPS CPUs

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
a58e561 RFC qemu-binfmt-conf.sh: Add MIPS64 o32 ABI dd1918b default-configs: Support o32 ABI with 64-bit MIPS CPUs 89b6078 linux-user/mips64: Support o32 ABI syscalls 5eacc3e linux-user/mips64: Restore setup_frame() for o32 ABI

=== OUTPUT BEGIN ===
1/4 Checking commit 5eacc3e0fcb8 (linux-user/mips64: Restore setup_frame() for o32 ABI) 2/4 Checking commit 89b6078d6798 (linux-user/mips64: Support o32 ABI syscalls) 3/4 Checking commit dd1918bdda51 (default-configs: Support o32 ABI with 64-bit MIPS CPUs)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #22:
new file mode 100644

total: 0 errors, 1 warnings, 16 lines checked

Patch 3/4 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
4/4 Checking commit a58e5610b2e7 (RFC qemu-binfmt-conf.sh: Add MIPS64 o32 ABI)
ERROR: line over 90 characters
#21: FILE: scripts/qemu-binfmt-conf.sh:71:
+mips64o32el_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00'

ERROR: line over 90 characters
#22: FILE: scripts/qemu-binfmt-conf.sh:72:
+mips64o32el_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'

total: 2 errors, 0 warnings, 10 lines checked

Patch 4/4 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#21 lore raw
In reply to Philippe Mathieu-Daudé

Hi Laurent,

Quoted 7 lines · Philippe Mathieu-Daudé

This series allow building linux-user emulator to run ELF binaries built for the MIPS o32 ABI on 64-bit CPUs (binaries produced by Sony Linux Toolkit for Playstation 2 for the R5900 CPU).

The new QEMU binary is named 'qemu-mips64o32'.

Quoted 8 lines

The binfmt config isn't correct, as it matches mipsel/mipsn32el. I missed to understand how mipsel (o32) and mipsn32el (n32) are differentiated.

Philippe Mathieu-Daudé (4):
linux-user/mips64: Restore setup_frame() for o32 ABI linux-user/mips64: Support o32 ABI syscalls

Until we figure out the issue raised by Maciej in patch 3, can you review/queue patches 1 and 2 which are independent of the outcome?

Thanks,

Phil.

#22 lore raw

ping?

Quoted 27 lines · Philippe Mathieu-Daudé

Hi Laurent,

Quoted 7 lines · Philippe Mathieu-Daudé

This series allow building linux-user emulator to run ELF binaries built for the MIPS o32 ABI on 64-bit CPUs (binaries produced by Sony Linux Toolkit for Playstation 2 for the R5900 CPU).

The new QEMU binary is named 'qemu-mips64o32'.

Quoted 8 lines

The binfmt config isn't correct, as it matches mipsel/mipsn32el. I missed to understand how mipsel (o32) and mipsn32el (n32) are differentiated.

Philippe Mathieu-Daudé (4):
linux-user/mips64: Restore setup_frame() for o32 ABI linux-user/mips64: Support o32 ABI syscalls

Until we figure out the issue raised by Maciej in patch 3, can you review/queue patches 1 and 2 which are independent of the outcome?

Thanks,

Phil.