]> Git Repo - qemu.git/blob - include/qemu/cpu.h
qom: Introduce CPU class
[qemu.git] / include / qemu / cpu.h
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 #ifndef QEMU_CPU_H
21 #define QEMU_CPU_H
22
23 #include "qemu/object.h"
24
25 /**
26  * SECTION:cpu
27  * @section_id: QEMU-cpu
28  * @title: CPU Class
29  * @short_description: Base class for all CPUs
30  */
31
32 #define TYPE_CPU "cpu"
33
34 #define CPU(obj) OBJECT_CHECK(CPUState, (obj), TYPE_CPU)
35 #define CPU_CLASS(class) OBJECT_CLASS_CHECK(CPUClass, (class), TYPE_CPU)
36 #define CPU_GET_CLASS(obj) OBJECT_GET_CLASS(CPUClass, (obj), TYPE_CPU)
37
38 typedef struct CPUState CPUState;
39
40 /**
41  * CPUClass:
42  * @reset: Callback to reset the #CPU to its initial state.
43  *
44  * Represents a CPU family or model.
45  */
46 typedef struct CPUClass {
47     /*< private >*/
48     ObjectClass parent_class;
49     /*< public >*/
50
51     void (*reset)(CPUState *cpu);
52 } CPUClass;
53
54 /**
55  * CPUState:
56  *
57  * State of one CPU core or thread.
58  */
59 struct CPUState {
60     /*< private >*/
61     Object parent_obj;
62     /*< public >*/
63
64     /* TODO Move common fields from CPUState here. */
65 };
66
67
68 /**
69  * cpu_reset:
70  * @cpu: The CPU whose state is to be reset.
71  */
72 void cpu_reset(CPUState *cpu);
73
74
75 #endif
This page took 0.028105 seconds and 4 git commands to generate.