On 7/29/21 8:14 AM, Philippe Mathieu-Daudé wrote:
> On 7/29/21 2:46 AM, Richard Henderson wrote:
>> This began with Peter wanting a cpu_ldst.h interface that can handle
>> alignment info for Arm M-profile system mode, which will also compile
>> for user-only without ifdefs. This is patch 32.
>>
>> Once I had that interface, I thought I might as well enforce the
>> requested alignment in user-only. There are plenty of cases where
>> we ought to have been doing that for quite a while. This took rather
>> more work than I imagined to start.
>>
>> So far only x86 host has been fully converted to handle unaligned
>> operations in user-only mode. I'll get to the others later. But
>> the added testcase is fairly broad, and caught lots of bugs and/or
>> missing code between target/ and linux-user/.
>>
>> Notes:
>> * For target/i386 we have no way to signal SIGBUS from user-only.
>> In theory we could go through do_unaligned_access in system mode,
>> via #AC. But we don't even implement that control in tcg, probably
>> because no one ever sets it. The cmpxchg16b insn requires alignment,
>> but raises #GP, which maps to SIGSEGV.
>>
>> * For target/s390x we have no way to signal SIGBUS from user-only.
>> The atomic operations raise PGM_SPECIFICATION, which the linux
>> kernel maps to SIGILL.
>>
>> * I think target/hexagon should be setting TARGET_ALIGNED_ONLY=y.
>> In the meantime, all memory accesses are allowed to be unaligned.
>
> Now I better understand what you tried to explain me last with
> TCGCPUOps. Since Claudio was also involved, Cc'ing him (not asking
> for a review, just in case he wants to follow up).
>
Thanks, what I understand from glancing through the thread is that
at the time we made handling of unaligned access a sysmmu-only TCGCPUOps,
while this series corrects that and implements unaligned accesses for user-only,
so seems good to me.
Ciao,
Claudio