diff options
author | Keith Packard <keithp@keithp.com> | 2023-08-02 20:52:31 -0700 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2024-04-09 07:43:31 -1000 |
commit | 5888357942da1fd5a50efb6e4a6af8b1a27a5af8 (patch) | |
tree | 364d0b0d72af5ceab93d52a9c3a8179252a3ff3b /target/m68k/cpu.c | |
parent | b754cb2dcde26a7bc8a9d17bb6900a0ac0dd38e2 (diff) | |
download | qemu-5888357942da1fd5a50efb6e4a6af8b1a27a5af8.zip qemu-5888357942da1fd5a50efb6e4a6af8b1a27a5af8.tar.gz qemu-5888357942da1fd5a50efb6e4a6af8b1a27a5af8.tar.bz2 |
target/m68k: Map FPU exceptions to FPSR register
Add helpers for reading/writing the 68881 FPSR register so that
changes in floating point exception state can be seen by the
application.
Call these helpers in pre_load/post_load hooks to synchronize
exception state.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230803035231.429697-1-keithp@keithp.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/m68k/cpu.c')
-rw-r--r-- | target/m68k/cpu.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 7c8efbb..df49ff1 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -390,12 +390,19 @@ static const VMStateDescription vmstate_freg = { } }; -static int fpu_post_load(void *opaque, int version) +static int fpu_pre_save(void *opaque) { M68kCPU *s = opaque; - cpu_m68k_restore_fp_status(&s->env); + s->env.fpsr = cpu_m68k_get_fpsr(&s->env); + return 0; +} + +static int fpu_post_load(void *opaque, int version) +{ + M68kCPU *s = opaque; + cpu_m68k_set_fpsr(&s->env, s->env.fpsr); return 0; } @@ -404,6 +411,7 @@ const VMStateDescription vmmstate_fpu = { .version_id = 1, .minimum_version_id = 1, .needed = fpu_needed, + .pre_save = fpu_pre_save, .post_load = fpu_post_load, .fields = (const VMStateField[]) { VMSTATE_UINT32(env.fpcr, M68kCPU), |