From patchwork Fri Feb 3 02:59:37 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: 139272 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B1746104792 for ; Fri, 3 Feb 2012 14:02:53 +1100 (EST) Received: from localhost ([::1]:40670 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt9QI-0008Oi-MT for incoming@patchwork.ozlabs.org; Thu, 02 Feb 2012 22:02:50 -0500 Received: from eggs.gnu.org ([140.186.70.92]:38668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt9Pw-0007w3-RY for qemu-devel@nongnu.org; Thu, 02 Feb 2012 22:02:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rt9Pu-00061c-0n for qemu-devel@nongnu.org; Thu, 02 Feb 2012 22:02:28 -0500 Received: from cantor2.suse.de ([195.135.220.15]:55624 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt9Pt-00061U-Rz for qemu-devel@nongnu.org; Thu, 02 Feb 2012 22:02:25 -0500 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 3C5A090072 for ; Fri, 3 Feb 2012 04:02:25 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Fri, 3 Feb 2012 03:59:37 +0100 Message-Id: <1328237992-14953-7-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1328237992-14953-1-git-send-email-afaerber@suse.de> References: <1328237992-14953-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?= Subject: [Qemu-devel] [PATCH RFC v3 06/21] target-arm: Prepare model-specific class_init function 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 This allows to share initialization between CPU models. Signed-off-by: Andreas Färber --- target-arm/cpu.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/target-arm/cpu.c b/target-arm/cpu.c index 43231c9..b794ec1 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -96,6 +96,7 @@ static void arm_cpu_reset(CPU *c) typedef struct ARMCPUInfo { const char *name; uint32_t id; + void (*class_init)(ARMCPUClass *klass, const struct ARMCPUInfo *info); } ARMCPUInfo; static const ARMCPUInfo arm_cpus[] = { @@ -230,6 +231,10 @@ static void arm_cpu_class_init(ObjectClass *klass, void *data) cpu_class->reset = arm_cpu_reset; k->cp15.c0_cpuid = info->id; + + if (info->class_init != NULL) { + (*info->class_init)(k, info); + } } static void cpu_register(const ARMCPUInfo *info)