|
|
1.1 root 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_initfn(Object *obj)
49: {
50: S390CPU *cpu = S390_CPU(obj);
51: CPUS390XState *env = &cpu->env;
52: static int cpu_num = 0;
53: #if !defined(CONFIG_USER_ONLY)
54: struct tm tm;
55: #endif
56:
57: cpu_exec_init(env);
58: #if !defined(CONFIG_USER_ONLY)
59: qemu_get_timedate(&tm, 0);
60: env->tod_offset = TOD_UNIX_EPOCH +
61: (time2tod(mktimegm(&tm)) * 1000000000ULL);
62: env->tod_basetime = 0;
63: env->tod_timer = qemu_new_timer_ns(vm_clock, s390x_tod_timer, cpu);
64: env->cpu_timer = qemu_new_timer_ns(vm_clock, s390x_cpu_timer, cpu);
65: #endif
66: env->cpu_num = cpu_num++;
67: env->ext_index = -1;
68:
69: cpu_reset(CPU(cpu));
70: }
71:
72: static void s390_cpu_class_init(ObjectClass *oc, void *data)
73: {
74: S390CPUClass *scc = S390_CPU_CLASS(oc);
75: CPUClass *cc = CPU_CLASS(scc);
76:
77: scc->parent_reset = cc->reset;
78: cc->reset = s390_cpu_reset;
79: }
80:
81: static const TypeInfo s390_cpu_type_info = {
82: .name = TYPE_S390_CPU,
83: .parent = TYPE_CPU,
84: .instance_size = sizeof(S390CPU),
85: .instance_init = s390_cpu_initfn,
86: .abstract = false,
87: .class_size = sizeof(S390CPUClass),
88: .class_init = s390_cpu_class_init,
89: };
90:
91: static void s390_cpu_register_types(void)
92: {
93: type_register_static(&s390_cpu_type_info);
94: }
95:
96: type_init(s390_cpu_register_types)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.