]> git.proxmox.com Git - qemu.git/blame - qom/cpu.c
cpu: Move exit_request field to CPUState
[qemu.git] / qom / cpu.c
CommitLineData
dd83b06a
AF
1/*
2 * QEMU CPU model
3 *
4 * Copyright (c) 2012 SUSE LINUX Products GmbH
5 *
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.
10 *
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.
15 *
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>
19 */
20
14cccb61 21#include "qom/cpu.h"
dd83b06a
AF
22#include "qemu-common.h"
23
24void cpu_reset(CPUState *cpu)
25{
26 CPUClass *klass = CPU_GET_CLASS(cpu);
27
28 if (klass->reset != NULL) {
29 (*klass->reset)(cpu);
30 }
31}
32
33static void cpu_common_reset(CPUState *cpu)
34{
fcd7d003 35 cpu->exit_request = 0;
dd83b06a
AF
36}
37
2b8c2754
AF
38ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model)
39{
40 CPUClass *cc = CPU_CLASS(object_class_by_name(typename));
41
42 return cc->class_by_name(cpu_model);
43}
44
45static ObjectClass *cpu_common_class_by_name(const char *cpu_model)
46{
47 return NULL;
48}
49
4f658099
AF
50static void cpu_common_realizefn(DeviceState *dev, Error **errp)
51{
52}
53
dd83b06a
AF
54static void cpu_class_init(ObjectClass *klass, void *data)
55{
961f8395 56 DeviceClass *dc = DEVICE_CLASS(klass);
dd83b06a
AF
57 CPUClass *k = CPU_CLASS(klass);
58
2b8c2754 59 k->class_by_name = cpu_common_class_by_name;
dd83b06a 60 k->reset = cpu_common_reset;
4f658099 61 dc->realize = cpu_common_realizefn;
961f8395 62 dc->no_user = 1;
dd83b06a
AF
63}
64
961f8395 65static const TypeInfo cpu_type_info = {
dd83b06a 66 .name = TYPE_CPU,
961f8395 67 .parent = TYPE_DEVICE,
dd83b06a
AF
68 .instance_size = sizeof(CPUState),
69 .abstract = true,
70 .class_size = sizeof(CPUClass),
71 .class_init = cpu_class_init,
72};
73
74static void cpu_register_types(void)
75{
76 type_register_static(&cpu_type_info);
77}
78
79type_init(cpu_register_types)