From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Riku Voipio <riku.voipio@iki.fi>, qemu-arm <qemu-arm@nongnu.org>,
Amanieu d'Antras <amanieu@gmail.com>,
QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH] linux-user/arm: Reset CPSR_E when entering a signal handler
Date: Sat, 16 May 2020 10:25:44 -0700 [thread overview]
Message-ID: <6f45a4d8-844e-8c94-ebcd-af87d03c28d7@linaro.org> (raw)
In-Reply-To: <CAFEAcA_5_98BZfTbdLTR75w=qdOVVKra3eCM0YKX_gUEJSfkkw@mail.gmail.com>
On 5/16/20 5:58 AM, Peter Maydell wrote:
> On Sat, 16 May 2020 at 05:12, Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> On 5/15/20 2:25 PM, Peter Maydell wrote:
>>>> You also need to call arm_rebuild_hflags() after modifying CPSR_E
>>>> otherwise the change doesn't take effect.
>>>
>>> Hmm. I was expecting cpsr_write() to take care of that if we
>>> updated a cpsr flag that was in the hflags, but it looks like
>>> the rebuild_hflags() is in the HELPER() wrapper but not in
>>> cpsr_write() itself. Richard, does anything go wrong if
>>> cpsr_write() proper does the hflags rebuild ?
>>
>> We wind up rebuilding hflags multiple times, is all.
>>
>> Most of the time we call cpsr_write we also do something else that also
>> requires a rebuild. So we do it once after all updates.
>
> The downside is that it leaves a trap which makes it really
> easy to introduce bugs where hflags aren't rebuilt: as
> a caller of cpsr_write() I don't really want to have to
> care which cpsr flags happen to be in the hflags or not,
> and it's particularly awkward that simply fixing which
> flags belong in CPSR_USER suddenly means that a call
> that happened to be OK before is now buggy.
I don't see any way around that.
As I said, if we put the rebuild in cpsr_write, then we should also rearrange
the code that calls cpsr_write to assume that's where the rebuild gets done.
r~
prev parent reply other threads:[~2020-05-16 17:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-07 20:24 [PATCH] linux-user/arm: Reset CPSR_E when entering a signal handler Amanieu d'Antras
2020-05-11 11:13 ` Peter Maydell
2020-05-15 18:33 ` Peter Maydell
2020-05-15 20:41 ` Amanieu d'Antras
2020-05-15 21:25 ` Peter Maydell
2020-05-16 4:12 ` Richard Henderson
2020-05-16 12:58 ` Peter Maydell
2020-05-16 17:25 ` Richard Henderson [this message]
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=6f45a4d8-844e-8c94-ebcd-af87d03c28d7@linaro.org \
--to=richard.henderson@linaro.org \
--cc=amanieu@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/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).