|
|
1.1 root 1: /*
2: * QEMU SuperH CPU
3: *
4: * Copyright (c) 2005 Samuel Tardieu
5: * Copyright (c) 2012 SUSE LINUX Products GmbH
6: *
7: * This library is free software; you can redistribute it and/or
8: * modify it under the terms of the GNU Lesser General Public
9: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or (at your option) any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this library; if not, see
19: * <http://www.gnu.org/licenses/lgpl-2.1.html>
20: */
21:
22: #include "cpu.h"
23: #include "qemu-common.h"
24:
25:
26: /* CPUClass::reset() */
27: static void superh_cpu_reset(CPUState *s)
28: {
29: SuperHCPU *cpu = SUPERH_CPU(s);
30: SuperHCPUClass *scc = SUPERH_CPU_GET_CLASS(cpu);
31: CPUSH4State *env = &cpu->env;
32:
33: if (qemu_loglevel_mask(CPU_LOG_RESET)) {
34: qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
35: log_cpu_state(env, 0);
36: }
37:
38: scc->parent_reset(s);
39:
40: memset(env, 0, offsetof(CPUSH4State, breakpoints));
41: tlb_flush(env, 1);
42:
43: env->pc = 0xA0000000;
44: #if defined(CONFIG_USER_ONLY)
45: env->fpscr = FPSCR_PR; /* value for userspace according to the kernel */
46: set_float_rounding_mode(float_round_nearest_even, &env->fp_status); /* ?! */
47: #else
48: env->sr = SR_MD | SR_RB | SR_BL | SR_I3 | SR_I2 | SR_I1 | SR_I0;
49: env->fpscr = FPSCR_DN | FPSCR_RM_ZERO; /* CPU reset value according to SH4 manual */
50: set_float_rounding_mode(float_round_to_zero, &env->fp_status);
51: set_flush_to_zero(1, &env->fp_status);
52: #endif
53: set_default_nan_mode(1, &env->fp_status);
54: }
55:
56: static void superh_cpu_initfn(Object *obj)
57: {
58: SuperHCPU *cpu = SUPERH_CPU(obj);
59: CPUSH4State *env = &cpu->env;
60:
61: cpu_exec_init(env);
62:
63: env->movcal_backup_tail = &(env->movcal_backup);
64: }
65:
66: static void superh_cpu_class_init(ObjectClass *oc, void *data)
67: {
68: CPUClass *cc = CPU_CLASS(oc);
69: SuperHCPUClass *scc = SUPERH_CPU_CLASS(oc);
70:
71: scc->parent_reset = cc->reset;
72: cc->reset = superh_cpu_reset;
73: }
74:
75: static const TypeInfo superh_cpu_type_info = {
76: .name = TYPE_SUPERH_CPU,
77: .parent = TYPE_CPU,
78: .instance_size = sizeof(SuperHCPU),
79: .instance_init = superh_cpu_initfn,
80: .abstract = false,
81: .class_size = sizeof(SuperHCPUClass),
82: .class_init = superh_cpu_class_init,
83: };
84:
85: static void superh_cpu_register_types(void)
86: {
87: type_register_static(&superh_cpu_type_info);
88: }
89:
90: type_init(superh_cpu_register_types)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.