4 * Copyright (c) 2012 SUSE LINUX Products GmbH
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see
18 * <http://www.gnu.org/licenses/gpl-2.0.html>
22 #include "qemu-common.h"
24 void cpu_reset(CPUState
*cpu
)
26 CPUClass
*klass
= CPU_GET_CLASS(cpu
);
28 if (klass
->reset
!= NULL
) {
33 static void cpu_common_reset(CPUState
*cpu
)
37 ObjectClass
*cpu_class_by_name(const char *typename
, const char *cpu_model
)
39 CPUClass
*cc
= CPU_CLASS(object_class_by_name(typename
));
41 return cc
->class_by_name(cpu_model
);
44 static ObjectClass
*cpu_common_class_by_name(const char *cpu_model
)
49 static void cpu_common_realizefn(DeviceState
*dev
, Error
**errp
)
53 static void cpu_class_init(ObjectClass
*klass
, void *data
)
55 DeviceClass
*dc
= DEVICE_CLASS(klass
);
56 CPUClass
*k
= CPU_CLASS(klass
);
58 k
->class_by_name
= cpu_common_class_by_name
;
59 k
->reset
= cpu_common_reset
;
60 dc
->realize
= cpu_common_realizefn
;
64 static const TypeInfo cpu_type_info
= {
66 .parent
= TYPE_DEVICE
,
67 .instance_size
= sizeof(CPUState
),
69 .class_size
= sizeof(CPUClass
),
70 .class_init
= cpu_class_init
,
73 static void cpu_register_types(void)
75 type_register_static(&cpu_type_info
);
78 type_init(cpu_register_types
)