Re: [PATCH] m68k: nommu: fix memmove() with differently aligned src and dest for 68000
From: Daniel Palmer
Date: Fri Dec 19 2025 - 08:30:16 EST
Hi Greg,
On Fri, 19 Dec 2025 at 20:59, Greg Ungerer <gerg@xxxxxxxxxxxxxx> wrote:
>
> Hi Daniel,
>
> On 13/12/25 22:04, Daniel Palmer wrote:
> > 68000 has different alignment needs to 68020+.
> > memcpy() checks if the destination is aligned and does a smaller copy
> > to fix the alignment and then critically for 68000 it checks if the
> > source is still unaligned and if it is reverts to smaller copies.
> >
> > memmove() does not currently do the second part and malfunctions if
> > one of the pointers is aligned and the other isn't.
>
> What is the nature of the failure, is it a trap?
Address error because of the unaligned address. This was actually a
real pain to work out because on QEMU it worked fine (mainline QEMU
allows the unaligned access[0]) and on the real CPU it just locked up.
Thanks!
Daniel
0 - https://gitlab.com/qemu-project/qemu/-/issues/2165