]> git.proxmox.com Git - qemu.git/blob - target-s390x/cpu.c
target-s390x: QOM'ify CPU reset
[qemu.git] / target-s390x / cpu.c
1 /*
2 * QEMU S/390 CPU
3 *
4 * Copyright (c) 2009 Ulrich Hecht
5 * Copyright (c) 2011 Alexander Graf
6 * Copyright (c) 2012 SUSE LINUX Products GmbH
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, see
20 * <http://www.gnu.org/licenses/lgpl-2.1.html>
21 */
22
23 #include "cpu-qom.h"
24 #include "qemu-common.h"
25 #include "qemu-timer.h"
26
27
28 /* CPUClass::reset() */
29 static void s390_cpu_reset(CPUState *s)
30 {
31 S390CPU *cpu = S390_CPU(s);
32 S390CPUClass *scc = S390_CPU_GET_CLASS(cpu);
33 CPUS390XState *env = &cpu->env;
34
35 if (qemu_loglevel_mask(CPU_LOG_RESET)) {
36 qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
37 log_cpu_state(env, 0);
38 }
39
40 scc->parent_reset(s);
41
42 memset(env, 0, offsetof(CPUS390XState, breakpoints));
43 /* FIXME: reset vector? */
44 tlb_flush(env, 1);
45 s390_add_running_cpu(env);
46 }
47
48 static void s390_cpu_class_init(ObjectClass *oc, void *data)
49 {
50 S390CPUClass *scc = S390_CPU_CLASS(oc);
51 CPUClass *cc = CPU_CLASS(scc);
52
53 scc->parent_reset = cc->reset;
54 cc->reset = s390_cpu_reset;
55 }
56
57 static const TypeInfo s390_cpu_type_info = {
58 .name = TYPE_S390_CPU,
59 .parent = TYPE_CPU,
60 .instance_size = sizeof(S390CPU),
61 .abstract = false,
62 .class_size = sizeof(S390CPUClass),
63 .class_init = s390_cpu_class_init,
64 };
65
66 static void s390_cpu_register_types(void)
67 {
68 type_register_static(&s390_cpu_type_info);
69 }
70
71 type_init(s390_cpu_register_types)