target/xtensa: move xtensa_finalize_config to xtensa_core_class_init

Don't run xtensa_finalize_config at the time of core registration,
instead run it at the CPU class initialization.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
Max Filippov 2019-02-09 20:43:58 -08:00
parent 2012f47e23
commit 0e7c887919
3 changed files with 19 additions and 19 deletions

View File

@ -566,7 +566,6 @@ void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
void xtensa_translate_init(void); void xtensa_translate_init(void);
void xtensa_breakpoint_handler(CPUState *cs); void xtensa_breakpoint_handler(CPUState *cs);
void xtensa_finalize_config(XtensaConfig *config);
void xtensa_register_core(XtensaConfigList *node); void xtensa_register_core(XtensaConfigList *node);
void xtensa_sim_open_console(Chardev *chr); void xtensa_sim_open_console(Chardev *chr);
void check_interrupts(CPUXtensaState *s); void check_interrupts(CPUXtensaState *s);

View File

@ -34,22 +34,6 @@
static struct XtensaConfigList *xtensa_cores; static struct XtensaConfigList *xtensa_cores;
static void xtensa_core_class_init(ObjectClass *oc, void *data)
{
CPUClass *cc = CPU_CLASS(oc);
XtensaCPUClass *xcc = XTENSA_CPU_CLASS(oc);
const XtensaConfig *config = data;
xcc->config = config;
/* Use num_core_regs to see only non-privileged registers in an unmodified
* gdb. Use num_regs to see all registers. gdb modification is required
* for that: reset bit 0 in the 'flags' field of the registers definitions
* in the gdb/xtensa-config.c inside gdb source tree or inside gdb overlay.
*/
cc->gdb_num_core_regs = config->gdb_regmap.num_regs;
}
static void init_libisa(XtensaConfig *config) static void init_libisa(XtensaConfig *config)
{ {
unsigned i, j; unsigned i, j;
@ -91,7 +75,7 @@ static void init_libisa(XtensaConfig *config)
config->a_regfile = xtensa_regfile_lookup(config->isa, "AR"); config->a_regfile = xtensa_regfile_lookup(config->isa, "AR");
} }
void xtensa_finalize_config(XtensaConfig *config) static void xtensa_finalize_config(XtensaConfig *config)
{ {
if (config->isa_internal) { if (config->isa_internal) {
init_libisa(config); init_libisa(config);
@ -112,6 +96,24 @@ void xtensa_finalize_config(XtensaConfig *config)
} }
} }
static void xtensa_core_class_init(ObjectClass *oc, void *data)
{
CPUClass *cc = CPU_CLASS(oc);
XtensaCPUClass *xcc = XTENSA_CPU_CLASS(oc);
XtensaConfig *config = data;
xtensa_finalize_config(config);
xcc->config = config;
/*
* Use num_core_regs to see only non-privileged registers in an unmodified
* gdb. Use num_regs to see all registers. gdb modification is required
* for that: reset bit 0 in the 'flags' field of the registers definitions
* in the gdb/xtensa-config.c inside gdb source tree or inside gdb overlay.
*/
cc->gdb_num_core_regs = config->gdb_regmap.num_regs;
}
void xtensa_register_core(XtensaConfigList *node) void xtensa_register_core(XtensaConfigList *node)
{ {
TypeInfo type = { TypeInfo type = {

View File

@ -377,7 +377,6 @@
static XtensaConfigList node = { \ static XtensaConfigList node = { \
.config = &core, \ .config = &core, \
}; \ }; \
xtensa_finalize_config(&core); \
xtensa_register_core(&node); \ xtensa_register_core(&node); \
} }
#else #else