target/m68k: add M68K_FEATURE_UNALIGNED_DATA feature
commita9431a03f70c8c711a870d4c1a0439bdbb4703cf
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Mon, 8 Mar 2021 12:11:55 +0000 (8 12:11 +0000)
committerLaurent Vivier <laurent@vivier.eu>
Thu, 11 Mar 2021 20:12:32 +0000 (11 21:12 +0100)
tree98a4da661d8f8093014142d086909a384c42ddf1
parent469949c90252d80693aa70652d8251d1d602557e
target/m68k: add M68K_FEATURE_UNALIGNED_DATA feature

According to the M68040UM Appendix D the requirement for data accesses to be
word aligned is only for the 68000, 68008 and 68010 CPUs. Later CPUs from the
68020 onwards will allow unaligned data accesses but at the cost of being less
efficient.

Add a new M68K_FEATURE_UNALIGNED_DATA feature to specify that data accesses are
not required to be word aligned, and don't perform the alignment on the stack
pointer when taking an exception if this feature is not selected.

This is required because the MacOS DAFB driver attempts to call an A-trap
with a byte-aligned stack pointer during initialisation and without this the
stack pointer is off by one when the A-trap returns.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210308121155.2476-4-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
target/m68k/cpu.c
target/m68k/cpu.h
target/m68k/op_helper.c