linux-user/sparc: Correct set/get_context handling of fp and i7
commit266b41582e0de8c30707614d6733ecf6485c7677
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 5 Nov 2020 21:23:13 +0000 (5 21:23 +0000)
committerLaurent Vivier <laurent@vivier.eu>
Tue, 10 Nov 2020 06:53:39 +0000 (10 07:53 +0100)
tree110b62c2dba4f4c1d191679bc530b0d8a4be1786
parentb8ae597f0e6df9d1d80e07083fabf763fcb46013
linux-user/sparc: Correct set/get_context handling of fp and i7

Because QEMU's user-mode emulation just directly accesses guest CPU
state, for SPARC the guest register window state is not the same in
the sparc64_get_context() and sparc64_set_context() functions as it
is for the real kernel's versions of those functions.  Specifically,
for the kernel it has saved the user space state such that the O*
registers go into a pt_regs struct as UREG_I*, and the I* registers
have been spilled onto the userspace stack.  For QEMU, we haven't
done that, so the guest's O* registers are still in WREG_O* and the
I* registers in WREG_I*.

The code was already accessing the O* registers correctly for QEMU,
but had copied the kernel code for accessing the I* registers off the
userspace stack.  Replace this with direct accesses to fp and i7 in
the CPU state, and add a comment explaining why we differ from the
kernel code here.

This fix is sufficient to get bash to a shell prompt.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20201105212314.9628-3-peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
linux-user/sparc/signal.c