From 2b8c27549917b3e07fec5807dbd2b6528ceb4efa Mon Sep 17 00:00:00 2001 From: Andreas Färber Date: Mon, 21 Jan 2013 18:26:21 +0100 Subject: cpu: Add model resolution support to CPUClass Introduce CPUClass::class_by_name and add a default implementation. Hook up the alpha and ppc implementations. Introduce a wrapper function cpu_class_by_name(). Signed-off-by: Andreas Färber --- include/qom/cpu.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 773caf9fa1..8097692bde 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -40,6 +40,8 @@ typedef struct CPUState CPUState; /** * CPUClass: + * @class_by_name: Callback to map -cpu command line model name to an + * instantiatable CPU type. * @reset: Callback to reset the #CPUState to its initial state. * * Represents a CPU family or model. @@ -49,6 +51,8 @@ typedef struct CPUClass { DeviceClass parent_class; /*< public >*/ + ObjectClass *(*class_by_name)(const char *cpu_model); + void (*reset)(CPUState *cpu); } CPUClass; @@ -107,6 +111,17 @@ struct CPUState { */ void cpu_reset(CPUState *cpu); +/** + * cpu_class_by_name: + * @typename: The CPU base type. + * @cpu_model: The model string without any parameters. + * + * Looks up a CPU #ObjectClass matching name @cpu_model. + * + * Returns: A #CPUClass or %NULL if not matching class is found. + */ +ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model); + /** * qemu_cpu_has_work: * @cpu: The vCPU to check. -- cgit v1.2.3-55-g7522