From patchwork Fri Feb 1 00:44:38 2013 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: 217325 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 3834F2C036B for ; Fri, 1 Feb 2013 12:42:46 +1100 (EST) Received: from localhost ([::1]:42692 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U14lp-0004L7-LY for incoming@patchwork.ozlabs.org; Thu, 31 Jan 2013 19:46:21 -0500 Received: from eggs.gnu.org ([208.118.235.92]:44467) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U14kj-0002MO-Jy for qemu-devel@nongnu.org; Thu, 31 Jan 2013 19:45:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U14kh-00051G-60 for qemu-devel@nongnu.org; Thu, 31 Jan 2013 19:45:13 -0500 Received: from cantor2.suse.de ([195.135.220.15]:34427 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U14kg-00050n-T5 for qemu-devel@nongnu.org; Thu, 31 Jan 2013 19:45:11 -0500 Received: from relay1.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 4AE12A39D2; Fri, 1 Feb 2013 01:45:10 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Fri, 1 Feb 2013 01:44:38 +0100 Message-Id: <1359679480-32356-11-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359679480-32356-1-git-send-email-afaerber@suse.de> References: <1359679480-32356-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Guan Xuetao , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH 10/12] target-unicore32: Rename CPU subtypes 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 In the initial conversion of CPU models to QOM types, model names were mapped 1:1 to type names. As a side effect this gained us a type "any", which is now a device. To avoid "-device any" silliness and to pave the way for compiling multiple targets into one executable, adopt a --cpu scheme. No functional changes for -cpu arguments. Signed-off-by: Andreas Färber --- target-unicore32/cpu.c | 9 ++++++--- target-unicore32/helper.c | 1 + 2 Dateien geändert, 7 Zeilen hinzugefügt(+), 3 Zeilen entfernt(-) diff --git a/target-unicore32/cpu.c b/target-unicore32/cpu.c index 18ef1c5..4e4177f 100644 --- a/target-unicore32/cpu.c +++ b/target-unicore32/cpu.c @@ -26,12 +26,15 @@ static inline void set_feature(CPUUniCore32State *env, int feature) static ObjectClass *uc32_cpu_class_by_name(const char *cpu_model) { ObjectClass *oc; + char *typename; if (cpu_model == NULL) { return NULL; } - oc = object_class_by_name(cpu_model); + typename = g_strdup_printf("%s-" TYPE_UNICORE32_CPU, cpu_model); + oc = object_class_by_name(typename); + g_free(typename); if (oc != NULL && (!object_class_dynamic_cast(oc, TYPE_UNICORE32_CPU) || object_class_is_abstract(oc))) { oc = NULL; @@ -84,7 +87,6 @@ static void uc32_cpu_initfn(Object *obj) CPUUniCore32State *env = &cpu->env; cpu_exec_init(env); - env->cpu_model_str = object_get_typename(obj); #ifdef CONFIG_USER_ONLY env->uncached_asr = ASR_MODE_USER; @@ -114,12 +116,13 @@ static void uc32_cpu_class_init(ObjectClass *oc, void *data) static void uc32_register_cpu_type(const UniCore32CPUInfo *info) { TypeInfo type_info = { - .name = info->name, .parent = TYPE_UNICORE32_CPU, .instance_init = info->instance_init, }; + type_info.name = g_strdup_printf("%s-" TYPE_UNICORE32_CPU, info->name); type_register(&type_info); + g_free((void *)type_info.name); } static const TypeInfo uc32_cpu_type_info = { diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c index 183b5b3..3a92232 100644 --- a/target-unicore32/helper.c +++ b/target-unicore32/helper.c @@ -38,6 +38,7 @@ CPUUniCore32State *uc32_cpu_init(const char *cpu_model) } cpu = UNICORE32_CPU(object_new(object_class_get_name(oc))); env = &cpu->env; + env->cpu_model_str = cpu_model; if (inited) { inited = 0;