mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
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]
This commit is contained in:
parent
32cf0ac2cc
commit
fc3630b2a9
4 changed files with 42 additions and 34 deletions
|
@ -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) &&
|
||||
|
|
|
@ -607,12 +607,8 @@ int sparc_cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
|
|||
uint8_t *buf, int len, bool is_write);
|
||||
#endif
|
||||
|
||||
|
||||
/* translate.c */
|
||||
void sparc_tcg_init(void);
|
||||
void sparc_restore_state_to_opc(CPUState *cs,
|
||||
const TranslationBlock *tb,
|
||||
const uint64_t *data);
|
||||
|
||||
/* fop_helper.c */
|
||||
target_ulong cpu_get_fsr(CPUSPARCState *);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "exec/log.h"
|
||||
#include "fpu/softfloat.h"
|
||||
#include "asi.h"
|
||||
#include "target/sparc/translate.h"
|
||||
|
||||
#define HELPER_H "helper.h"
|
||||
#include "exec/helper-info.c.inc"
|
||||
|
@ -101,13 +102,6 @@
|
|||
# define MAXTL_MASK 0
|
||||
#endif
|
||||
|
||||
/* Dynamic PC, must exit to main loop. */
|
||||
#define DYNAMIC_PC 1
|
||||
/* Dynamic PC, one of two values according to jump_pc[T2]. */
|
||||
#define JUMP_PC 2
|
||||
/* Dynamic PC, may lookup next TB. */
|
||||
#define DYNAMIC_PC_LOOKUP 3
|
||||
|
||||
#define DISAS_EXIT DISAS_TARGET_0
|
||||
|
||||
/* global register indexes */
|
||||
|
@ -5881,26 +5875,3 @@ void sparc_tcg_init(void)
|
|||
gregnames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
17
target/sparc/translate.h
Normal file
17
target/sparc/translate.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* QEMU translation definitions for SPARC
|
||||
*
|
||||
* Copyright (c) 2024 Linaro, Ltd
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#ifndef SPARC_TRANSLATION_H
|
||||
#define SPARC_TRANSLATION_H
|
||||
|
||||
/* Dynamic PC, must exit to main loop. */
|
||||
#define DYNAMIC_PC 1
|
||||
/* Dynamic PC, one of two values according to jump_pc[T2]. */
|
||||
#define JUMP_PC 2
|
||||
/* Dynamic PC, may lookup next TB. */
|
||||
#define DYNAMIC_PC_LOOKUP 3
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue