qemu-e2k/target-m68k
Greg Ungerer 0c8ff723bd m68k: fix usp processing on interrupt entry and exception exit
The action to potentially switch sp register is not occurring at the correct
point in the interrupt entry or exception exit sequences.

For the interrupt entry case the sp on entry is used to create the stack
exception frame - but this may well be the user stack pointer, since we
haven't done the switch yet. Re-order the flow to switch the sp regs then
use the current sp to create the exception frame.

For the return from exception case the code is unwinding the sp after
switching sp registers. But it should always unwind the supervisor sp
first, then carry out any required sp switch.

Note that these problems don't effect operation unless the user sp bit is
set in the CACR register. Only a single sp is used in the default power up
state. Previously Linux only used this single sp mode. But modern versions
of Linux use the user sp mode now, so we need correct behavior for Linux
to work.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Tested-by: Laurent Vivier <laurent@vivier.eu>
Message-id: 1434721406-25288-4-git-send-email-gerg@uclinux.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-06-22 14:43:25 +01:00
..
cpu-qom.h target-m68k: Use cpu_exec_interrupt qom hook 2014-09-25 18:54:21 +01:00
cpu.c target-m68k: Use cpu_exec_interrupt qom hook 2014-09-25 18:54:21 +01:00
cpu.h cpu: Make cpu_init() return QOM CPUState object 2015-03-10 17:33:51 +01:00
gdbstub.c cpu: Introduce CPUClass::gdb_{read,write}_register() 2013-07-27 00:04:17 +02:00
helper.c target-m68k: Use cpu_exec_enter/exit qom hooks 2014-09-25 18:54:21 +01:00
helper.h tcg: Invert the inclusion of helper.h 2014-05-28 09:33:54 -07:00
m68k-qreg.h
m68k-semi.c exec: Change cpu_abort() argument to CPUState 2014-03-13 19:52:28 +01:00
Makefile.objs cpu: Introduce CPUClass::gdb_{read,write}_register() 2013-07-27 00:04:17 +02:00
op_helper.c m68k: fix usp processing on interrupt entry and exception exit 2015-06-22 14:43:25 +01:00
qregs.def cpu: Move exception_index field from CPU_COMMON to CPUState 2014-03-13 19:20:46 +01:00
translate.c m68k: implement move to/from usp register instruction 2015-06-22 14:43:25 +01:00