From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>,
Helge Deller <deller@gmx.de>,
qemu-devel@nongnu.org
Cc: dave.anglin@bell.net
Subject: Re: [PATCH] target/hppa: Allow, but diagnose, LDCW aligned only mod 4
Date: Fri, 17 Jan 2020 19:20:32 +0100 [thread overview]
Message-ID: <55a08a64-79ee-48f3-e19b-4f0c2380b09f@redhat.com> (raw)
In-Reply-To: <57d3bd1a-0597-8353-46bd-09dd93347f7b@linaro.org>
On 1/17/20 6:30 PM, Richard Henderson wrote:
> On 1/17/20 6:13 AM, Philippe Mathieu-Daudé wrote:
>>>> - MemOp mop = MO_TEUL | MO_ALIGN_16 | a->size;
>>>> + MemOp mop = MO_TE | MO_ALIGN | a->size;
>>
>>
>> Hmmm you changed MO_TEUL -> MO_TE, so from MO_32 to MO_8.
>>
>> Per your description, shouldn't this be MO_TEUL | MO_ALIGN_4?
>
> The "UL" part is also being added by a->size. This code was written this way
> in preparation for the 64-bit ldc, and the bug was not noticable because we
> don't have that yet.
Ah I missed the a->size.
So on 32-bit the hw trap doesn't trap on unaligned 16, but traps on
unaligned 4.
On 64-bit we don't know yet, but IIUC we expect to not trap on unaligned 8.
Looking at target/hppa/insns.decode:
&ldst t b x disp sp m scale size
@ldstx ...... b:5 x:5 sp:2 scale:1 ....... m:1 t:5 &ldst disp=0
@ldim5 ...... b:5 ..... sp:2 ......... t:5 \
&ldst disp=%im5_16 x=0 scale=0 m=%ma_to_m
ldc 000011 ..... ..... .. . 1 -- 0111 ...... @ldim5
size=2
ldc 000011 ..... ..... .. . 0 -- 0111 ...... @ldstx
size=2
We have a->size = 2 = MO_32 = MO_UL.
So do you plan to add LDCD from PA2.0 using size=3, OK.
From "exec/memop.h":
* MO_ALIGN supposes the alignment size is the size of a memory access.
*
* There are three options:
* - unaligned access permitted (MO_UNALN).
* - an alignment to the size of an access (MO_ALIGN);
Ah so with LDCW we already access a word, so MO_ALIGN -> MO_ALIGN_4.
With LDLD we'll have MO_ALIGN -> MO_ALIGN_8.
Now "MemOp mop = MO_TE | MO_ALIGN | a->size;" makes sense!
The power of your decodetree script amazed me again :)
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
next prev parent reply other threads:[~2020-01-17 18:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-17 1:53 [PATCH] target/hppa: Allow, but diagnose, LDCW aligned only mod 4 Richard Henderson
2020-01-17 15:49 ` Helge Deller
2020-01-17 16:13 ` Philippe Mathieu-Daudé
2020-01-17 17:01 ` Helge Deller
2020-01-17 17:33 ` John David Anglin
2020-01-17 18:34 ` Richard Henderson
2020-01-17 17:30 ` Richard Henderson
2020-01-17 18:20 ` Philippe Mathieu-Daudé [this message]
2020-01-17 18:50 ` Philippe Mathieu-Daudé
2020-01-17 19:23 ` Richard Henderson
2020-01-17 19:57 ` Helge Deller
2020-01-18 6:10 ` Philippe Mathieu-Daudé
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=55a08a64-79ee-48f3-e19b-4f0c2380b09f@redhat.com \
--to=philmd@redhat.com \
--cc=dave.anglin@bell.net \
--cc=deller@gmx.de \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).