Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NJ9LB-00079T-DG for qemu-devel@nongnu.org; Fri, 11 Dec 2009 12:31:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NJ9L6-000740-9k for qemu-devel@nongnu.org; Fri, 11 Dec 2009 12:31:40 -0500 Received: from [199.232.76.173] (port=59051 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NJ9L6-00073n-30 for qemu-devel@nongnu.org; Fri, 11 Dec 2009 12:31:36 -0500 Received: from mx20.gnu.org ([199.232.41.8]:42077) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NJ9L5-0007rW-Ot for qemu-devel@nongnu.org; Fri, 11 Dec 2009 12:31:35 -0500 Received: from mail.codesourcery.com ([38.113.113.100]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NJ9L5-0008Ed-20 for qemu-devel@nongnu.org; Fri, 11 Dec 2009 12:31:35 -0500 From: Nathan Froyd Date: Fri, 11 Dec 2009 09:04:46 -0800 Message-Id: <1260551091-2890-3-git-send-email-froydnj@codesourcery.com> In-Reply-To: <1260551091-2890-1-git-send-email-froydnj@codesourcery.com> References: <1260551091-2890-1-git-send-email-froydnj@codesourcery.com> Subject: [Qemu-devel] [PATCH 2/7] linux-user: commonify definitions of target typedefs List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org There's no sense in separately declaring target_{elf_greg,uid,gid,pid}_t for every architecture. Just declare them once with appropriate USE_UID16 handling. Signed-off-by: Nathan Froyd --- linux-user/elfload.c | 32 ++++++++++---------------------- 1 files changed, 10 insertions(+), 22 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 76eb031..024dcc2 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -97,6 +97,16 @@ enum { #define ELIBBAD 80 #endif +typedef target_ulong target_elf_greg_t; +#ifdef USE_UID16 +typedef uint16_t target_uid_t; +typedef uint16_t target_gid_t; +#else +typedef uint32_t target_uid_t; +typedef uint32_t target_gid_t; +#endif +typedef int32_t target_pid_t; + #ifdef TARGET_I386 #define ELF_PLATFORM get_elf_platform() @@ -134,11 +144,6 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i regs->rip = infop->entry; } -typedef target_ulong target_elf_greg_t; -typedef uint32_t target_uid_t; -typedef uint32_t target_gid_t; -typedef int32_t target_pid_t; - #define ELF_NREG 27 typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG]; @@ -211,11 +216,6 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i regs->edx = 0; } -typedef target_ulong target_elf_greg_t; -typedef uint16_t target_uid_t; -typedef uint16_t target_gid_t; -typedef int32_t target_pid_t; - #define ELF_NREG 17 typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG]; @@ -286,11 +286,6 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i regs->ARM_r10 = infop->start_data; } -typedef uint32_t target_elf_greg_t; -typedef uint16_t target_uid_t; -typedef uint16_t target_gid_t; -typedef int32_t target_pid_t; - #define ELF_NREG 18 typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG]; @@ -1779,13 +1774,6 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, * #define ELF_NREG * typedef taret_elf_greg_t target_elf_gregset_t[ELF_NREG]; * - * Then define following types to match target types. Actual types can - * be found from linux kernel (arch//include/asm/posix_types.h): - * - * typedef target_uid_t; - * typedef target_gid_t; - * typedef target_pid_t; - * * Last step is to implement target specific function that copies registers * from given cpu into just specified register set. Prototype is: * -- 1.6.3.2