mirror of https://gitlab.com/qemu-project/qemu
target-xtensa: Move TCG initialization to XtensaCPU initfn
Combine this with breakpoint handler registration, guarding both with tcg_enabled() to suppress also TCG init for qtest. Rename the handler to xtensa_breakpoint_handler() since it needs to become global. Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
d9c27f00b1
commit
25733eada6
|
@ -71,8 +71,15 @@ static void xtensa_cpu_initfn(Object *obj)
|
||||||
{
|
{
|
||||||
XtensaCPU *cpu = XTENSA_CPU(obj);
|
XtensaCPU *cpu = XTENSA_CPU(obj);
|
||||||
CPUXtensaState *env = &cpu->env;
|
CPUXtensaState *env = &cpu->env;
|
||||||
|
static bool tcg_inited;
|
||||||
|
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env);
|
||||||
|
|
||||||
|
if (tcg_enabled() && !tcg_inited) {
|
||||||
|
tcg_inited = true;
|
||||||
|
xtensa_translate_init();
|
||||||
|
cpu_set_debug_excp_handler(xtensa_breakpoint_handler);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const VMStateDescription vmstate_xtensa_cpu = {
|
static const VMStateDescription vmstate_xtensa_cpu = {
|
||||||
|
|
|
@ -385,6 +385,7 @@ static inline CPUXtensaState *cpu_init(const char *cpu_model)
|
||||||
}
|
}
|
||||||
|
|
||||||
void xtensa_translate_init(void);
|
void xtensa_translate_init(void);
|
||||||
|
void xtensa_breakpoint_handler(CPUXtensaState *env);
|
||||||
int cpu_xtensa_exec(CPUXtensaState *s);
|
int cpu_xtensa_exec(CPUXtensaState *s);
|
||||||
void xtensa_register_core(XtensaConfigList *node);
|
void xtensa_register_core(XtensaConfigList *node);
|
||||||
void do_interrupt(CPUXtensaState *s);
|
void do_interrupt(CPUXtensaState *s);
|
||||||
|
|
|
@ -54,7 +54,7 @@ static uint32_t check_hw_breakpoints(CPUXtensaState *env)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void breakpoint_handler(CPUXtensaState *env)
|
void xtensa_breakpoint_handler(CPUXtensaState *env)
|
||||||
{
|
{
|
||||||
if (env->watchpoint_hit) {
|
if (env->watchpoint_hit) {
|
||||||
if (env->watchpoint_hit->flags & BP_CPU) {
|
if (env->watchpoint_hit->flags & BP_CPU) {
|
||||||
|
@ -72,8 +72,6 @@ static void breakpoint_handler(CPUXtensaState *env)
|
||||||
|
|
||||||
XtensaCPU *cpu_xtensa_init(const char *cpu_model)
|
XtensaCPU *cpu_xtensa_init(const char *cpu_model)
|
||||||
{
|
{
|
||||||
static int tcg_inited;
|
|
||||||
static int debug_handler_inited;
|
|
||||||
XtensaCPU *cpu;
|
XtensaCPU *cpu;
|
||||||
CPUXtensaState *env;
|
CPUXtensaState *env;
|
||||||
const XtensaConfig *config = NULL;
|
const XtensaConfig *config = NULL;
|
||||||
|
@ -93,16 +91,6 @@ XtensaCPU *cpu_xtensa_init(const char *cpu_model)
|
||||||
env = &cpu->env;
|
env = &cpu->env;
|
||||||
env->config = config;
|
env->config = config;
|
||||||
|
|
||||||
if (!tcg_inited) {
|
|
||||||
tcg_inited = 1;
|
|
||||||
xtensa_translate_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!debug_handler_inited && tcg_enabled()) {
|
|
||||||
debug_handler_inited = 1;
|
|
||||||
cpu_set_debug_excp_handler(breakpoint_handler);
|
|
||||||
}
|
|
||||||
|
|
||||||
xtensa_irq_init(env);
|
xtensa_irq_init(env);
|
||||||
|
|
||||||
object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
|
object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
|
||||||
|
|
Loading…
Reference in New Issue