From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNJU0-0000Up-KX for qemu-devel@nongnu.org; Wed, 03 Apr 2013 04:55:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNJTz-0003pW-HF for qemu-devel@nongnu.org; Wed, 03 Apr 2013 04:55:52 -0400 Received: from mail-qe0-f41.google.com ([209.85.128.41]:40684) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNJTz-0003pS-0D for qemu-devel@nongnu.org; Wed, 03 Apr 2013 04:55:51 -0400 Received: by mail-qe0-f41.google.com with SMTP id 7so746736qeb.28 for ; Wed, 03 Apr 2013 01:55:50 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <515BEE8E.1030701@redhat.com> Date: Wed, 03 Apr 2013 10:55:42 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1364913860-25159-1-git-send-email-pbonzini@redhat.com> <1364913860-25159-2-git-send-email-pbonzini@redhat.com> <515B0DD1.4030000@redhat.com> <515B14DF.1090109@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/5] configure: move TARGET_*_ALIGNMENT to target-*/cpu.h List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Blue Swirl , qemu-devel@nongnu.org, Aurelien Jarno , Alexander Graf Il 02/04/2013 19:47, Peter Maydell ha scritto: > On 2 April 2013 18:26, Paolo Bonzini wrote: >> I think "a thing the size of a pointer" should be abi_long/ulong. The >> pointer is not a CPU concept. > > Yeah. OTOH type alignment isn't a CPU concept either, so I'm > a little suspicious of these defines in general. Ok, the main case where the target alignment matters is in 'struct target_elf_prstatus' (linux-user/elfload.c). Linux, in its n32 implementation, explicitly uses a different struct that changes some longs to ints (pr_sigpend, pr_sighold, pr_flag) and keeps longs for others (pr_reg). --- typedef unsigned long elf_greg_t; typedef elf_greg_t elf_gregset_t[ELF_NGREG]; #define elf_prstatus elf_prstatus32 struct elf_prstatus32 { struct elf_siginfo pr_info; short pr_cursig; /* Current signal */ unsigned int pr_sigpend; /* Set of pending signals */ unsigned int pr_sighold; /* Set of held signals */ pid_t pr_pid; pid_t pr_ppid; pid_t pr_pgrp; pid_t pr_sid; struct compat_timeval pr_utime; /* User time */ struct compat_timeval pr_stime; /* System time */ struct compat_timeval pr_cutime;/* Cumulative user time */ struct compat_timeval pr_cstime;/* Cumulative system time */ elf_gregset_t pr_reg; /* GP registers */ int pr_fpvalid; }; --- Instead, we use target_ulong for both (possibly via the target_elf_greg_t typedef). sparc32plus and ppc64abi32 instead use 32-bit for pr_reg too (see include/linux/elfcore-compat.h and fs/compat_binfmt_elf.c). This is also wrong. In any case, what we are doing is doubly wrong. Things that have 4-byte alignment should also have 4-byte size. Things that have 8-byte alignment should also have 8-byte size. Paolo