Skip to content

Commit

Permalink
exec: split cpu_exec_init()
Browse files Browse the repository at this point in the history
Put in cpu_exec_initfn() what initializes the CPU,
and leave in cpu_exec_init() what adds it to the environment.

As cpu_exec_initfn() is called by all XX_cpu_initfn(), call it
directly in cpu_common_initfn().
cpu_exec_init() is now a realize function, it will be renamed
to cpu_exec_realizefn() and moved to the XX_cpu_realizefn()
function in a following patch.

Signed-off-by: Laurent Vivier <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Signed-off-by: Eduardo Habkost <[email protected]>
  • Loading branch information
vivier authored and ehabkost committed Oct 24, 2016
1 parent 00d0f9f commit 39e329e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
10 changes: 6 additions & 4 deletions exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,11 +610,8 @@ void cpu_exec_exit(CPUState *cpu)
}
}

void cpu_exec_init(CPUState *cpu, Error **errp)
void cpu_exec_initfn(CPUState *cpu)
{
CPUClass *cc ATTRIBUTE_UNUSED = CPU_GET_CLASS(cpu);
Error *local_err ATTRIBUTE_UNUSED = NULL;

cpu->as = NULL;
cpu->num_ases = 0;

Expand All @@ -635,6 +632,11 @@ void cpu_exec_init(CPUState *cpu, Error **errp)
cpu->memory = system_memory;
object_ref(OBJECT(cpu->memory));
#endif
}

void cpu_exec_init(CPUState *cpu, Error **errp)
{
CPUClass *cc ATTRIBUTE_UNUSED = CPU_GET_CLASS(cpu);

cpu_list_add(cpu);

Expand Down
1 change: 1 addition & 0 deletions include/qom/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,7 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx);

void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...)
GCC_FMT_ATTR(2, 3);
void cpu_exec_initfn(CPUState *cpu);
void cpu_exec_exit(CPUState *cpu);

#ifdef CONFIG_SOFTMMU
Expand Down
2 changes: 2 additions & 0 deletions qom/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ static void cpu_common_initfn(Object *obj)
QTAILQ_INIT(&cpu->watchpoints);

cpu->trace_dstate = bitmap_new(trace_get_vcpu_event_count());

cpu_exec_initfn(cpu);
}

static void cpu_common_finalize(Object *obj)
Expand Down

0 comments on commit 39e329e

Please sign in to comment.