root / qom / cpu.c @ 32efc535
History | View | Annotate | Download (1.4 kB)
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 |
|
21 |
#include "qemu/cpu.h" |
22 |
#include "qemu-common.h" |
23 |
|
24 |
void 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 |
|
33 |
static void cpu_common_reset(CPUState *cpu) |
34 |
{ |
35 |
} |
36 |
|
37 |
static void cpu_class_init(ObjectClass *klass, void *data) |
38 |
{ |
39 |
CPUClass *k = CPU_CLASS(klass); |
40 |
|
41 |
k->reset = cpu_common_reset; |
42 |
} |
43 |
|
44 |
static TypeInfo cpu_type_info = {
|
45 |
.name = TYPE_CPU, |
46 |
.parent = TYPE_OBJECT, |
47 |
.instance_size = sizeof(CPUState),
|
48 |
.abstract = true,
|
49 |
.class_size = sizeof(CPUClass),
|
50 |
.class_init = cpu_class_init, |
51 |
}; |
52 |
|
53 |
static void cpu_register_types(void) |
54 |
{ |
55 |
type_register_static(&cpu_type_info); |
56 |
} |
57 |
|
58 |
type_init(cpu_register_types) |