From patchwork Thu Oct 22 16:22:37 2015 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: 534477 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D2FBF141316 for ; Fri, 23 Oct 2015 03:23:35 +1100 (AEDT) Received: from localhost ([::1]:33113 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpIeL-0003IL-6q for incoming@patchwork.ozlabs.org; Thu, 22 Oct 2015 12:23:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpIdi-0002D3-VK for qemu-devel@nongnu.org; Thu, 22 Oct 2015 12:22:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZpIdd-0004IO-OG for qemu-devel@nongnu.org; Thu, 22 Oct 2015 12:22:54 -0400 Received: from mx2.suse.de ([195.135.220.15]:48711) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpIdd-0004Hv-HX for qemu-devel@nongnu.org; Thu, 22 Oct 2015 12:22:49 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5CA6AAC70; Thu, 22 Oct 2015 16:22:47 +0000 (UTC) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Thu, 22 Oct 2015 18:22:37 +0200 Message-Id: <1445530959-19309-7-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1445530959-19309-1-git-send-email-afaerber@suse.de> References: <1445530959-19309-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: Peter Crosthwaite , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Aurelien Jarno , Peter Crosthwaite Subject: [Qemu-devel] [PULL 6/8] disas: QOMify sh4 specific disas setup 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 From: Peter Crosthwaite Move the target_disas() sh4 specifics to the CPUClass::disas_set_info() hook and delete the #ifdef specific code in disas.c. Signed-off-by: Peter Crosthwaite Acked-by: Aurelien Jarno Signed-off-by: Andreas Färber --- disas.c | 6 ------ target-sh4/cpu.c | 11 ++++++++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/disas.c b/disas.c index b687c98..2676e2f 100644 --- a/disas.c +++ b/disas.c @@ -236,9 +236,6 @@ void target_disas(FILE *out, CPUState *cpu, target_ulong code, #else s.info.print_insn = print_insn_little_mips; #endif -#elif defined(TARGET_SH4) - s.info.mach = bfd_mach_sh4; - s.info.print_insn = print_insn_sh; #elif defined(TARGET_ALPHA) s.info.mach = bfd_mach_alpha_ev6; s.info.print_insn = print_insn_alpha; @@ -436,9 +433,6 @@ void monitor_disas(Monitor *mon, CPUState *cpu, #else s.info.print_insn = print_insn_little_mips; #endif -#elif defined(TARGET_SH4) - s.info.mach = bfd_mach_sh4; - s.info.print_insn = print_insn_sh; #endif if (!s.info.print_insn) { monitor_printf(mon, "0x" TARGET_FMT_lx diff --git a/target-sh4/cpu.c b/target-sh4/cpu.c index 64e4467..d7e2fbd 100644 --- a/target-sh4/cpu.c +++ b/target-sh4/cpu.c @@ -70,6 +70,12 @@ static void superh_cpu_reset(CPUState *s) set_default_nan_mode(1, &env->fp_status); } +static void superh_cpu_disas_set_info(CPUState *cpu, disassemble_info *info) +{ + info->mach = bfd_mach_sh4; + info->print_insn = print_insn_sh; +} + typedef struct SuperHCPUListState { fprintf_function cpu_fprintf; FILE *file; @@ -288,9 +294,12 @@ static void superh_cpu_class_init(ObjectClass *oc, void *data) #else cc->get_phys_page_debug = superh_cpu_get_phys_page_debug; #endif - dc->vmsd = &vmstate_sh_cpu; + cc->disas_set_info = superh_cpu_disas_set_info; + cc->gdb_num_core_regs = 59; + dc->vmsd = &vmstate_sh_cpu; + /* * Reason: superh_cpu_initfn() calls cpu_exec_init(), which saves * the object in cpus -> dangling pointer after final