From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Blue Swirl <blauwirbel@gmail.com>,
qemu-devel@nongnu.org, Aurelien Jarno <aurelien@aurel32.net>,
Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH 1/5] configure: move TARGET_*_ALIGNMENT to target-*/cpu.h
Date: Wed, 03 Apr 2013 10:55:42 +0200 [thread overview]
Message-ID: <515BEE8E.1030701@redhat.com> (raw)
In-Reply-To: <CAFEAcA9Wss4UxO+-qJSqbrsO1FL-Zs=NxYWAYvK-u4mDeQnqbw@mail.gmail.com>
Il 02/04/2013 19:47, Peter Maydell ha scritto:
> On 2 April 2013 18:26, Paolo Bonzini <pbonzini@redhat.com> 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
next prev parent reply other threads:[~2013-04-03 8:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-02 14:44 [Qemu-devel] [PATCH 0/5] trim down config-target.mak Paolo Bonzini
2013-04-02 14:44 ` [Qemu-devel] [PATCH 1/5] configure: move TARGET_*_ALIGNMENT to target-*/cpu.h Paolo Bonzini
2013-04-02 16:43 ` Peter Maydell
2013-04-02 16:56 ` Paolo Bonzini
2013-04-02 17:17 ` Peter Maydell
2013-04-02 17:26 ` Paolo Bonzini
2013-04-02 17:47 ` Peter Maydell
2013-04-03 8:55 ` Paolo Bonzini [this message]
2013-04-02 17:57 ` Aurelien Jarno
2013-04-02 14:44 ` [Qemu-devel] [PATCH 2/5] cpu: default TARGET_LONG_ALIGNMENT to TARGET_LONG_SIZE Paolo Bonzini
2013-04-02 15:16 ` Peter Maydell
2013-04-02 14:44 ` [Qemu-devel] [PATCH 3/5] configure: move CONFIG_QEMU_LDST_OPTIMIZATION to config-host.mak Paolo Bonzini
2013-04-02 16:45 ` Peter Maydell
2013-04-02 14:44 ` [Qemu-devel] [PATCH 4/5] configure: move common libraries " Paolo Bonzini
2013-04-02 17:01 ` Peter Maydell
2013-04-02 17:26 ` Paolo Bonzini
2013-04-02 18:17 ` Peter Maydell
2013-04-02 18:51 ` Paolo Bonzini
2013-04-02 14:44 ` [Qemu-devel] [PATCH 5/5] configure: CONFIG_NO_XEN is duplicated Paolo Bonzini
2013-04-02 16:54 ` Stefano Stabellini
2013-04-02 17:24 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=515BEE8E.1030701@redhat.com \
--to=pbonzini@redhat.com \
--cc=agraf@suse.de \
--cc=aurelien@aurel32.net \
--cc=blauwirbel@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).