From patchwork Tue Apr 10 22:40:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 151699 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0785AB704E for ; Wed, 11 Apr 2012 08:41:03 +1000 (EST) Received: from localhost ([::1]:37397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SHjkC-0003LD-Sg for incoming@patchwork.ozlabs.org; Tue, 10 Apr 2012 18:41:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SHjjy-0003HR-QO for qemu-devel@nongnu.org; Tue, 10 Apr 2012 18:40:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SHjju-0001SL-OC for qemu-devel@nongnu.org; Tue, 10 Apr 2012 18:40:46 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49184 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SHjju-0001S2-F4 for qemu-devel@nongnu.org; Tue, 10 Apr 2012 18:40:42 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 5143394373; Wed, 11 Apr 2012 00:40:41 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Wed, 11 Apr 2012 00:40:33 +0200 Message-Id: <1334097633-3009-3-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1334097633-3009-1-git-send-email-afaerber@suse.de> References: <1334097633-3009-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Richard Henderson Subject: [Qemu-devel] [PATCH v2 2/2] target-alpha: QOM'ify CPU init X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Move code from cpu_alpha_init() into a CPU initializer. Signed-off-by: Andreas Färber --- target-alpha/cpu.c | 20 ++++++++++++++++++++ target-alpha/translate.c | 12 +----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c index 315b0c1..62d2a66 100644 --- a/target-alpha/cpu.c +++ b/target-alpha/cpu.c @@ -1,6 +1,7 @@ /* * QEMU Alpha CPU * + * Copyright (c) 2007 Jocelyn Mayer * Copyright (c) 2012 SUSE LINUX Products GmbH * * This library is free software; you can redistribute it and/or @@ -22,10 +23,29 @@ #include "qemu-common.h" +static void alpha_cpu_initfn(Object *obj) +{ + AlphaCPU *cpu = ALPHA_CPU(obj); + CPUAlphaState *env = &cpu->env; + + cpu_exec_init(env); + tlb_flush(env, 1); + +#if defined(CONFIG_USER_ONLY) + env->ps = PS_USER_MODE; + cpu_alpha_store_fpcr(env, (FPCR_INVD | FPCR_DZED | FPCR_OVFD + | FPCR_UNFD | FPCR_INED | FPCR_DNOD + | FPCR_DYN_NORMAL)); +#endif + env->lock_addr = -1; + env->fen = 1; +} + static const TypeInfo alpha_cpu_type_info = { .name = TYPE_ALPHA_CPU, .parent = TYPE_CPU, .instance_size = sizeof(AlphaCPU), + .instance_init = alpha_cpu_initfn, .abstract = false, .class_size = sizeof(AlphaCPUClass), }; diff --git a/target-alpha/translate.c b/target-alpha/translate.c index f773e6c..12de6a3 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -3531,9 +3531,8 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model) cpu = ALPHA_CPU(object_new(TYPE_ALPHA_CPU)); env = &cpu->env; - cpu_exec_init(env); + alpha_translate_init(); - tlb_flush(env, 1); /* Default to ev67; no reason not to emulate insns by default. */ implver = IMPLVER_21264; @@ -3551,15 +3550,6 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model) env->implver = implver; env->amask = amask; -#if defined (CONFIG_USER_ONLY) - env->ps = PS_USER_MODE; - cpu_alpha_store_fpcr(env, (FPCR_INVD | FPCR_DZED | FPCR_OVFD - | FPCR_UNFD | FPCR_INED | FPCR_DNOD - | FPCR_DYN_NORMAL)); -#endif - env->lock_addr = -1; - env->fen = 1; - qemu_init_vcpu(env); return env; }