linux-user: create target_structs header to place ipc_perm and shmid_ds
PATCH v3 1/2 linux-user: create target_structs header to place ipc_perm and shmid_ds
From: Petar Jovanovic <[email protected]>
Creating target_structs header in linux-user/$arch/ and making target_ipc_perm and target_shmid_ds its first inhabitants.
The struct defintions may/should be further fine-tuned by arch maintainers.
---
v3:
- add GNU licence to the new header files.
v2:
- target_struct headers have been created and the patch has been split into two separate patches.
linux-user/aarch64/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/alpha/target_structs.h | 48 ++++++++++++++++++++ linux-user/arm/target_structs.h | 52 ++++++++++++++++++++++ linux-user/cris/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/i386/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/m68k/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/microblaze/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/mips/target_structs.h | 48 ++++++++++++++++++++ linux-user/mips64/target_cpu.h | 18 ++++++++ linux-user/mips64/target_structs.h | 2 + linux-user/openrisc/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/ppc/target_structs.h | 60 +++++++++++++++++++++++++ linux-user/qemu.h | 1 + linux-user/s390x/target_structs.h | 63 ++++++++++++++++++++++++++ linux-user/sh4/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/sparc/target_structs.h | 63 ++++++++++++++++++++++++++ linux-user/sparc64/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/syscall.c | 76 ++++++++++++-------------------- linux-user/unicore32/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/x86_64/target_structs.h | 58 ++++++++++++++++++++++++ 20 files changed, 963 insertions(+), 48 deletions(-) create mode 100644 linux-user/aarch64/target_structs.h create mode 100644 linux-user/alpha/target_structs.h create mode 100644 linux-user/arm/target_structs.h create mode 100644 linux-user/cris/target_structs.h create mode 100644 linux-user/i386/target_structs.h create mode 100644 linux-user/m68k/target_structs.h create mode 100644 linux-user/microblaze/target_structs.h create mode 100644 linux-user/mips/target_structs.h create mode 100644 linux-user/mips64/target_structs.h create mode 100644 linux-user/openrisc/target_structs.h create mode 100644 linux-user/ppc/target_structs.h create mode 100644 linux-user/s390x/target_structs.h create mode 100644 linux-user/sh4/target_structs.h create mode 100644 linux-user/sparc/target_structs.h create mode 100644 linux-user/sparc64/target_structs.h create mode 100644 linux-user/unicore32/target_structs.h create mode 100644 linux-user/x86_64/target_structs.h
linux-user/aarch64/target_structs.h new file +58 -0
@@ -0,0 +1,58 @@ +/* +* ARM AArch64 specific structures for linux-user +* +* Copyright (c) 2013 Fabrice Bellard +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef TARGET_STRUCTS_H +#define TARGET_STRUCTS_H + +struct target_ipc_perm { +abi_int __key;/* Key. */ +abi_uint uid;/* Owner's user ID. */ +abi_uint gid;/* Owner's group ID. */ +abi_uint cuid;/* Creator's user ID. */ +abi_uint cgid;/* Creator's group ID. */ +abi_ushort mode;/* Read/write permission. */ +abi_ushort __pad1; +abi_ushort __seq;/* Sequence number. */ +abi_ushort __pad2; +abi_ulong __unused1; +abi_ulong __unused2; +}; + +struct target_shmid_ds { +struct target_ipc_perm shm_perm;/* operation permission struct */ +abi_long shm_segsz;/* size of segment in bytes */ +abi_ulong shm_atime;/* time of last shmat() */ +#if TARGET_ABI_BITS ==32 +abi_ulong __unused1; +#endif +abi_ulong shm_dtime;/* time of last shmdt() */ +#if TARGET_ABI_BITS ==32 +abi_ulong __unused2; +#endif +abi_ulong shm_ctime;/* time of last change by shmctl() */ +#if TARGET_ABI_BITS ==32 +abi_ulong __unused3; +#endif +abi_int shm_cpid;/* pid of creator */ +abi_int shm_lpid;/* pid of last shmop */ +abi_ulong shm_nattch;/* number of current attaches */ +abi_ulong __unused4; +abi_ulong __unused5; +}; + +#endif
linux-user/alpha/target_structs.h new file +48 -0
48 lines not on this page · raw message
linux-user/arm/target_structs.h new file +52 -0
52 lines not on this page · raw message
linux-user/cris/target_structs.h new file +58 -0
58 lines not on this page · raw message
linux-user/i386/target_structs.h new file +58 -0
58 lines not on this page · raw message
linux-user/m68k/target_structs.h new file +58 -0
58 lines not on this page · raw message
linux-user/microblaze/target_structs.h new file +58 -0
58 lines not on this page · raw message
linux-user/mips/target_structs.h new file +48 -0
48 lines not on this page · raw message
linux-user/mips64/target_cpu.h +18 -0
@@ -1 +1,19 @@ +/* +* MIPS64 specific structures for linux-user +* +* Copyright (c) 2013 Fabrice Bellard +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ #include "../mips/target_cpu.h"
linux-user/mips64/target_structs.h new file +2 -0
@@ -0,0 +1,2 @@ +#include "../mips/target_structs.h" +
linux-user/openrisc/target_structs.h new file +58 -0
58 lines not on this page · raw message
linux-user/ppc/target_structs.h new file +60 -0
60 lines not on this page · raw message
linux-user/qemu.h +1 -0
@@ -452,5 +452,6 @@ static inline void *lock_user_string(abi_ulong guest_addr)*/ #include "target_cpu.h" #include "target_signal.h" +#include "target_structs.h" #endif /* QEMU_H */
linux-user/s390x/target_structs.h new file +63 -0
63 lines not on this page · raw message
linux-user/sh4/target_structs.h new file +58 -0
58 lines not on this page · raw message
linux-user/sparc/target_structs.h new file +63 -0
63 lines not on this page · raw message
linux-user/sparc64/target_structs.h new file +58 -0
58 lines not on this page · raw message
linux-user/syscall.c +28 -48
102 lines not on this page · raw message
linux-user/unicore32/target_structs.h new file +58 -0
58 lines not on this page · raw message
linux-user/x86_64/target_structs.h new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v3 2/2 linux-user: pass correct parameter to do_shmctl()
From: Petar Jovanovic <[email protected]>
Fix shmctl issue by passing correct parameter buf to do_shmctl().
--- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/syscall.c +1 -1
@@ -3196,7 +3196,7 @@ static abi_long do_ipc(unsigned int call, int first,/* IPC_* and SHM_* command values are the same on all linux platforms */ case IPCOP_shmctl: - ret =do_shmctl (first, second, third); + ret =do_shmctl (first, second, ptr);break ;default :gemu_log ("Unsupported ipc call: %d (version %d)\n" , call, version);
Signature · 1 line
1.7.9.5
Re: [Qemu-devel] [PATCH v3 1/2] linux-user: create target_structsheader to place ipc_perm and shmid_dss
In reply to Petar JovanovicQuoted 28 lines · [email protected] writes:
From: Petar Jovanovic <[email protected]>
Creating
target_structsheader in linux-user/$arch/ and makingtarget_ipc_permandtarget_shmid_dsits first inhabitants.
The struct defintions may/should be further fine-tuned by arch maintainers.Signed-off-by Petar Jovanovic <[email protected]>---
v3:
- add GNU licence to the new header files.v2:
-target_structheaders have been created and the patch has been split into two separate patches.linux-user/aarch64/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/alpha/target_structs.h | 48 ++++++++++++++++++++ linux-user/arm/target_structs.h | 52 ++++++++++++++++++++++ linux-user/cris/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/i386/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/m68k/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/microblaze/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/mips/target_structs.h | 48 ++++++++++++++++++++ linux-user/mips64/target_cpu.h | 18 ++++++++ linux-user/mips64/target_structs.h | 2 + linux-user/openrisc/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/ppc/target_structs.h | 60 +++++++++++++++++++++++++ linux-user/qemu.h | 1 +
Quoted 8 lines
linux-user/s390x/target_structs.h | 63 ++++++++++++++++++++++++++ linux-user/sh4/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/sparc/target_structs.h | 63 ++++++++++++++++++++++++++ linux-user/sparc64/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/syscall.c | 76 ++++++++++++-------------------- linux-user/unicore32/target_structs.h | 58 ++++++++++++++++++++++++ linux-user/x86_64/target_structs.h | 58 ++++++++++++++++++++++++ 20 files changed, 963 insertions(+), 48 deletions(-)
<snip>
There is an awful lot of similarity between a lot of the structures while not being totally identical. Given the syscall munging is common is there not an argument for having a common header for this case?
Signature · 1 line
Alex Bennée
Re: [Qemu-devel] [PATCH v3 1/2] linux-user: create target_structsheader to place ipc_perm and shmid_dss
________________________________________
From: Alex Bennée [[email protected]]
Sent: Monday, November 04, 2013 5:46 PM
To: Petar Jovanovic
Cc: [email protected]; [email protected]; [email protected]; Petar Jovanovic; [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH v3 1/2] linux-user: create target_structsheader to place ipc_perm and shmid_dss
Quoted 3 lines
There is an awful lot of similarity between a lot of the structures while not being totally identical. Given the syscall munging is common is there not an argument for having a common header for this case?
Hi Alex,
I am not sure I understand your point. This used to be all in one file, now it is divided in arch-specific files that can be later populated with other target specific struct definitions. This was also suggested in the first review a month ago.
Regards,
Petar
Re: [Qemu-devel] [PATCH v3 1/2] linux-user: create target_structsheader to place ipc_perm and shmid_dss
Quoted 4 lines · Petar Jovanovic
I am not sure I understand your point. This used to be all in one file, now it is divided in arch-specific files that can be later populated with other target specific struct definitions. This was also suggested in the first review a month ago.
Yeah, the idea is to keep target-specifics separate and also to make it obvious (as in compile-failure) when a structure needs to be created or checked for a new target. Where the kernel has a "common" struct that targets can opt into via #defining something we can do the same, of course.
(That said, the necessity for #ifdefs in the functions which do the byteswapping of fields is a bit ugly. I meant to look into whether that could be avoided somehow...)
-- PMM
Re: [Qemu-devel] [PATCH v3 1/2] linux-user: create target_structsheader to place ipc_perm and shmid_dss
In reply to Petar JovanovicQuoted 2 lines · [email protected] writes:
________________________________________
From: Alex Bennée [[email protected]]
<snip>
Quoted 11 lines
Quoted 4 lines
There is an awful lot of similarity between a lot of the structures while not being totally identical. Given the syscall munging is common is there not an argument for having a common header for this case?
Hi Alex,
I am not sure I understand your point. This used to be all in one file, now it is divided in arch-specific files that can be later populated with other target specific struct definitions. This was also suggested in the first review a month ago.
I've looked back and I can see the point of moving it out of the syscall.c into the appropriate linux-user/${foo}/target_structs.h. However for the cases where the given structure is identical maybe linux-user/${foo}/target_structs.h should do an:
#include <linux-user/common/ipc_struct.h>
Having essentially the same definition in multiple places makes common fixes potentially miss architectures. If a given architecture then needs it's own special snowflake version it can of course not include the common version and define it directly in target_structs.h.
Where is the reference for each of these structures? The kernels own headers or glibc's for the appropriate arch?
Signature · 1 line
Alex Bennée
Re: [Qemu-devel] [PATCH v3 1/2] linux-user: create target_structsheader to place ipc_perm and shmid_dss
Quoted 2 lines · Alex Bennée
Where is the reference for each of these structures? The kernels own headers or glibc's for the appropriate arch?
Always the kernel -- we are implementing the syscall interface, not the glibc function.
-- PMM
Re: [Qemu-devel] [PATCH v3 1/2] linux-user: create target_structsheader to place ipc_perm and shmid_dss
In reply to Alex Bennée________________________________________
From: Alex Bennée [[email protected]]
Sent: Tuesday, November 05, 2013 3:46 PM
To: Petar Jovanovic
Cc: Petar Jovanovic; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH v3 1/2] linux-user: create target_structsheader to place ipc_perm and shmid_dss
Quoted 5 lines
I've looked back and I can see the point of moving it out of the
syscall.cinto the appropriatelinux-user/${foo}/target_structs.h. However for the cases where the given structure is identical maybelinux-user/${foo}/target_structs.hshould do an:
#include <linux-user/common/ipc_struct.h>
All the architectures that use common most often used defintion of ipc_perm and shmid_ds already have the correct definition in the file. If there are any changes in future, they will be arch-specific, so I'd disagree with the above.
I'd suggest we commit the change as-is now, and if there are future cases that may need different solution, we can fine-tune it later.
Cheers,
Petar
Re: [Qemu-devel] [PATCH v3 1/2] linux-user: create target_structsheader to place ipc_perm and shmid_dss
ping
http://patchwork.ozlabs.org/patch/287211/
http://patchwork.ozlabs.org/patch/287213/
Riku?
Regards,
Petar
Re: [Qemu-devel] [PATCH v3 1/2] linux-user: create target_structsheader to place ipc_perm and shmid_dss
ping
http://patchwork.ozlabs.org/patch/287211/
http://patchwork.ozlabs.org/patch/287213/
________________________________________
From: Petar Jovanovic
Sent: Tuesday, November 12, 2013 4:40 PM
To: [email protected]; [email protected]
Cc: Petar Jovanovic; [email protected]; [email protected]; [email protected]; Alex Bennée
Subject: RE: [Qemu-devel] [PATCH v3 1/2] linux-user: create target_structsheader to place ipc_perm and shmid_dss
ping
http://patchwork.ozlabs.org/patch/287211/
http://patchwork.ozlabs.org/patch/287213/
Riku?
Regards,
Petar