4 * Copyright (c) 2008 AXIS Communications AB
5 * Written by Edgar E. Iglesias.
7 * Copyright (c) 2012 SUSE LINUX Products GmbH
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, see
21 * <http://www.gnu.org/licenses/lgpl-2.1.html>
25 #include "qemu-common.h"
29 /* CPUClass::reset() */
30 static void cris_cpu_reset(CPUState *s)
32 CRISCPU *cpu = CRIS_CPU(s);
33 CRISCPUClass *ccc = CRIS_CPU_GET_CLASS(cpu);
34 CPUCRISState *env = &cpu->env;
37 if (qemu_loglevel_mask(CPU_LOG_RESET)) {
38 qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
39 log_cpu_state(env, 0);
44 vr = env->pregs[PR_VR];
45 memset(env, 0, offsetof(CPUCRISState, breakpoints));
46 env->pregs[PR_VR] = vr;
49 #if defined(CONFIG_USER_ONLY)
50 /* start in user mode with interrupts enabled. */
51 env->pregs[PR_CCS] |= U_FLAG | I_FLAG | P_FLAG;
54 env->pregs[PR_CCS] = 0;
58 static void cris_cpu_class_init(ObjectClass *oc, void *data)
60 CPUClass *cc = CPU_CLASS(oc);
61 CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
63 ccc->parent_reset = cc->reset;
64 cc->reset = cris_cpu_reset;
67 static const TypeInfo cris_cpu_type_info = {
68 .name = TYPE_CRIS_CPU,
70 .instance_size = sizeof(CRISCPU),
72 .class_size = sizeof(CRISCPUClass),
73 .class_init = cris_cpu_class_init,
76 static void cris_cpu_register_types(void)
78 type_register_static(&cris_cpu_type_info);
81 type_init(cris_cpu_register_types)