linux-user/syscall: fix target_msqid_ds time fields order
PATCH v2 1/1 linux-user/syscall: fix target_msqid_ds time fields order
target_msqid_ds::msg_*time field pairs are reversed on 32-bit TARGET_PPC and TARGET_SPARC and on big-endian TARGET_MIPS and TARGET_XTENSA. Fix the order to match the kernel definitions.
The issue is spotted by the libc-test http://nsz.repo.hu/git/?p=libc-test
on big-endian xtensa core.
---
Changes v1->v2:
- split into a separate patch
- add PPC, SPARC and big-endian MIPS
linux-user/syscall.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
linux-user/syscall.c +15 -5
@@ -4113,17 +4113,27 @@ static inline abi_long do_semtimedop(int semid,struct target_msqid_ds {struct target_ipc_perm msg_perm; -abi_ulong msg_stime;#if TARGET_ABI_BITS ==32 +#if defined(TARGET_PPC ) || defined(TARGET_SPARC ) || \ + (TARGET_BIG_ENDIAN && (defined(TARGET_MIPS ) || defined(TARGET_XTENSA ))) +abi_ulong __unused1; +abi_ulong msg_stime; +abi_ulong __unused2; +abi_ulong msg_rtime; +abi_ulong __unused3; +abi_ulong msg_ctime; +#else +abi_ulong msg_stime;abi_ulong __unused1; -#endif abi_ulong msg_rtime; -#if TARGET_ABI_BITS ==32 abi_ulong __unused2; -#endif abi_ulong msg_ctime; -#if TARGET_ABI_BITS ==32 abi_ulong __unused3; +#endif +#else +abi_ulong msg_stime; +abi_ulong msg_rtime; +abi_ulong msg_ctime;#endif abi_ulong __msg_cbytes;abi_ulong msg_qnum;
Signature · 1 line
2.39.2
Quoted 8 lines · Max Filippov
target_msqid_ds::msg_*time field pairs are reversed on 32-bit
TARGET_PPCandTARGET_SPARCand on big-endianTARGET_MIPSandTARGET_XTENSA. Fix the order to match the kernel definitions.
The issue is spotted by the libc-test http://nsz.repo.hu/git/?p=libc-test
on big-endian xtensa core.Signed-off-by Max Filippov <[email protected]>
Just come across this old patch, is it not needed anymore or has it been lost? (I realize the current code uses target_time64_t instead of abi_ulong, so probably not needed now)
Thanks,
/mjt
Quoted 44 lines
Changes
v1->v2:
- split into a separate patch
- add PPC, SPARC and big-endian MIPSlinux-user/syscall.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)linux-user/syscall.c +15
-5@@ -4113,17 +4113,27 @@ static inline abi_long do_semtimedop(int semid,struct target_msqid_ds {struct target_ipc_perm msg_perm; -abi_ulong msg_stime;#if TARGET_ABI_BITS ==32 +#if defined(TARGET_PPC ) || defined(TARGET_SPARC ) || \ + (TARGET_BIG_ENDIAN && (defined(TARGET_MIPS ) || defined(TARGET_XTENSA ))) +abi_ulong __unused1; +abi_ulong msg_stime; +abi_ulong __unused2; +abi_ulong msg_rtime; +abi_ulong __unused3; +abi_ulong msg_ctime; +#else +abi_ulong msg_stime;abi_ulong __unused1; -#endif abi_ulong msg_rtime; -#if TARGET_ABI_BITS ==32 abi_ulong __unused2; -#endif abi_ulong msg_ctime; -#if TARGET_ABI_BITS ==32 abi_ulong __unused3; +#endif +#else +abi_ulong msg_stime; +abi_ulong msg_rtime; +abi_ulong msg_ctime;#endif abi_ulong __msg_cbytes;abi_ulong msg_qnum;
Quoted 11 lines · Michael Tokarev
Quoted 8 lines · Max Filippov
target_msqid_ds::msg_*time field pairs are reversed on 32-bit
TARGET_PPCandTARGET_SPARCand on big-endianTARGET_MIPSandTARGET_XTENSA. Fix the order to match the kernel definitions.
The issue is spotted by the libc-test http://nsz.repo.hu/git/?p=libc-test
on big-endian xtensa core.Signed-off-by Max Filippov <[email protected]>Just come across this old patch, is it not needed anymore or has it been lost?
Yes, seems to have been lost.
Quoted 2 lines
(I realize the current code uses
target_time64_tinstead ofabi_ulong, so probably not needed now)
Right. Unless we have an alignment problem with target_time64_t on 32-bit (which seems ok).
Helge
Quoted 46 lines
Quoted 44 lines
Changes
v1->v2:
- split into a separate patch
- add PPC, SPARC and big-endian MIPS
linux-user/syscall.c| 20 +++++++++++++++-----1 file changed, 15 insertions(+), 5 deletions(-)linux-user/syscall.c +0
-0@@ -4113,17 +4113,27 @@ static inline abi_long do_semtimedop(int semid,struct
target_msqid_ds
{
structtarget_ipc_permmsg_perm;
-abi_ulongmsg_stime;
#ifTARGET_ABI_BITS== 32linux-user/syscall.c +10
-0+#if defined(TARGET_PPC ) || defined(TARGET_SPARC ) || \ + (TARGET_BIG_ENDIAN && (defined(TARGET_MIPS) || defined(TARGET_XTENSA))) + abi_ulong __unused1; + abi_ulong msg_stime; + abi_ulong __unused2; + abi_ulong msg_rtime; + abi_ulong __unused3; + abi_ulong msg_ctime; +#else + abi_ulong msg_stime;
abi_ulong__unused1;
-#endif
abi_ulongmsg_rtime;
-#ifTARGET_ABI_BITS== 32
abi_ulong__unused2;
-#endif
abi_ulongmsg_ctime;
-#ifTARGET_ABI_BITS== 32
abi_ulong__unused3;linux-user/syscall.c +5
-0+#endif +#else + abi_ulong msg_stime; + abi_ulong msg_rtime; + abi_ulong msg_ctime;#endif
abi_ulong__msg_cbytes;
abi_ulongmsg_qnum;