diff options
| author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2024-11-15 11:03:46 +0100 |
|---|---|---|
| committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2024-12-20 17:44:57 +0100 |
| commit | fc3630b2a9d17c7bc7cfd03a15cf91d7fdd26355 (patch) | |
| tree | fdaeef455fb19bcb92b7980e76db07431d1577ba /target/sparc/cpu.c | |
| parent | 32cf0ac2ccef1182705531a5383d432b3c76d995 (diff) | |
| download | focaccia-qemu-fc3630b2a9d17c7bc7cfd03a15cf91d7fdd26355.tar.gz focaccia-qemu-fc3630b2a9d17c7bc7cfd03a15cf91d7fdd26355.zip | |
target/sparc: Move sparc_restore_state_to_opc() to cpu.c
Most targets define their restore_state_to_opc() handler in cpu.c. In order to keep SPARC aligned, move sparc_restore_state_to_opc() from translate.c to cpu.c. Suggested-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20241115152053.66442-4-philmd@linaro.org> [PMD: Move definitions to new target/sparc/translate.h]
Diffstat (limited to 'target/sparc/cpu.c')
| -rw-r--r-- | target/sparc/cpu.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index b11f3248d8..fc0c66afec 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -27,6 +27,7 @@ #include "qapi/visitor.h" #include "tcg/tcg.h" #include "fpu/softfloat.h" +#include "target/sparc/translate.h" //#define DEBUG_FEATURES @@ -751,6 +752,29 @@ void cpu_get_tb_cpu_state(CPUSPARCState *env, vaddr *pc, *pflags = flags; } +static void sparc_restore_state_to_opc(CPUState *cs, + const TranslationBlock *tb, + const uint64_t *data) +{ + CPUSPARCState *env = cpu_env(cs); + target_ulong pc = data[0]; + target_ulong npc = data[1]; + + env->pc = pc; + if (npc == DYNAMIC_PC) { + /* dynamic NPC: already stored */ + } else if (npc & JUMP_PC) { + /* jump PC: use 'cond' and the jump targets of the translation */ + if (env->cond) { + env->npc = npc & ~3; + } else { + env->npc = pc + 4; + } + } else { + env->npc = npc; + } +} + static bool sparc_cpu_has_work(CPUState *cs) { return (cs->interrupt_request & CPU_INTERRUPT_HARD) && |