mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
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 <afaerber@suse.de>
This commit is contained in:
parent
2c728dfef5
commit
2b8c275499
4 changed files with 38 additions and 0 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue