Andreas Färber | 25ebd80 | 2012-04-06 19:46:48 +0200 | [diff] [blame] | 1 | /* |
| 2 | * QEMU Alpha CPU |
| 3 | * |
Andreas Färber | 9444006 | 2012-04-07 01:19:45 +0200 | [diff] [blame] | 4 | * Copyright (c) 2007 Jocelyn Mayer |
Andreas Färber | 25ebd80 | 2012-04-06 19:46:48 +0200 | [diff] [blame] | 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-qom.h" |
| 23 | #include "qemu-common.h" |
| 24 | |
| 25 | |
Andreas Färber | 9444006 | 2012-04-07 01:19:45 +0200 | [diff] [blame] | 26 | static void alpha_cpu_initfn(Object *obj) |
| 27 | { |
| 28 | AlphaCPU *cpu = ALPHA_CPU(obj); |
| 29 | CPUAlphaState *env = &cpu->env; |
| 30 | |
| 31 | cpu_exec_init(env); |
| 32 | tlb_flush(env, 1); |
| 33 | |
| 34 | #if defined(CONFIG_USER_ONLY) |
| 35 | env->ps = PS_USER_MODE; |
| 36 | cpu_alpha_store_fpcr(env, (FPCR_INVD | FPCR_DZED | FPCR_OVFD |
| 37 | | FPCR_UNFD | FPCR_INED | FPCR_DNOD |
| 38 | | FPCR_DYN_NORMAL)); |
| 39 | #endif |
| 40 | env->lock_addr = -1; |
| 41 | env->fen = 1; |
| 42 | } |
| 43 | |
Andreas Färber | 25ebd80 | 2012-04-06 19:46:48 +0200 | [diff] [blame] | 44 | static const TypeInfo alpha_cpu_type_info = { |
| 45 | .name = TYPE_ALPHA_CPU, |
| 46 | .parent = TYPE_CPU, |
| 47 | .instance_size = sizeof(AlphaCPU), |
Andreas Färber | 9444006 | 2012-04-07 01:19:45 +0200 | [diff] [blame] | 48 | .instance_init = alpha_cpu_initfn, |
Andreas Färber | 25ebd80 | 2012-04-06 19:46:48 +0200 | [diff] [blame] | 49 | .abstract = false, |
| 50 | .class_size = sizeof(AlphaCPUClass), |
| 51 | }; |
| 52 | |
| 53 | static void alpha_cpu_register_types(void) |
| 54 | { |
| 55 | type_register_static(&alpha_cpu_type_info); |
| 56 | } |
| 57 | |
| 58 | type_init(alpha_cpu_register_types) |