From patchwork Sun Jul 12 02:00:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 494065 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 CC5F71402B6 for ; Sun, 12 Jul 2015 12:02:39 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=WVmy9/S9; dkim-atps=neutral Received: from localhost ([::1]:49524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZE6bG-0002Zy-1P for incoming@patchwork.ozlabs.org; Sat, 11 Jul 2015 22:02:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZE6Z6-0006nf-Hm for qemu-devel@nongnu.org; Sat, 11 Jul 2015 22:00:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZE6Z4-0008MF-JT for qemu-devel@nongnu.org; Sat, 11 Jul 2015 22:00:24 -0400 Received: from mail-pd0-x233.google.com ([2607:f8b0:400e:c02::233]:35235) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZE6Z4-0008M1-Bn for qemu-devel@nongnu.org; Sat, 11 Jul 2015 22:00:22 -0400 Received: by pdrg1 with SMTP id g1so72414070pdr.2 for ; Sat, 11 Jul 2015 19:00:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=tDms0b7GgAedotynZAFZV5JzjZX2u9YQdjGg2A//qNY=; b=WVmy9/S9/9wfj6SQgVNZUAYDtFj/hRjAqe7vCI7dsQRPyDtRCFV+nkg3wii2qG3JIs WIoJJk6wz/sIQGUKamgbjL10KUvM3l1XkMrDF8PuMlAD0qmv6irKJ5BsgrBvmHGJWiYP ssdN9d5KPBumXm6QRomG8rdQ08p8aFe5kyEJPnY+qwlTZn6D/eaBf1b2CSBPJdqFh/UD TLbaT1eTH/iIGlRMNHrveGqYoid+GkS4dBWKj4SFvWSXOsGnJk18jB+IE5KgAzq63VfW Oc2ew7+cnRM0PdQaltCVkvOGSXhZRUs6S9VBcAdoQ4CDD4uls1VV0SDb798PJBcaMCoI QuYg== X-Received: by 10.70.36.234 with SMTP id t10mr56197982pdj.145.1436666421646; Sat, 11 Jul 2015 19:00:21 -0700 (PDT) Received: from pcrost-laptop.hsd1.ca.comcast.net (c-73-15-58-35.hsd1.ca.comcast.net. [73.15.58.35]) by smtp.gmail.com with ESMTPSA id ia3sm13842784pbc.31.2015.07.11.19.00.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 11 Jul 2015 19:00:20 -0700 (PDT) From: Peter Crosthwaite X-Google-Original-From: Peter Crosthwaite To: qemu-devel@nongnu.org Date: Sat, 11 Jul 2015 19:00:02 -0700 Message-Id: <785edcb010af4dd5bb1d5371491eb30667278557.1436665556.git.crosthwaite.peter@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c02::233 Cc: Peter Crosthwaite , Michael Walle , afaerber@suse.de, Peter Crosthwaite Subject: [Qemu-devel] [PATCH 5/8] disas: lm32: QOMify target 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() lm32 specifics to the QOM disas_set_info hook and delete the #ifdef specific code in disas.c. Cc: Michael Walle Signed-off-by: Peter Crosthwaite Acked-by: Michael Walle --- Testing: $ ./lm32-softmmu/qemu-system-lm32 -kernel ./random_code -S -d in_asm -nographic QEMU 2.3.90 monitor - type 'help' for more information (qemu) info cpus * CPU #0: thread_id=1113 (qemu) info registers IN: PC=8000000 ... (qemu) x/i 0x8000000 0x08000000: 7d 41 3a 22 cmpnei r1, r10, 14882 (qemu) x/i 0x8000004 0x08000004: 54 28 6b de bgu r8, r1, 801af7c (qemu) c $ more err 08000000: 7d413a22 cmpnei r10, r1, 14882 08000004: 54286bde bgu r1, r8, 110456 0x08000000: 7d 41 3a 22 cmpnei r1, r10, 14882 0x08000004: 54 28 6b de bgu r8, r1, 801af7c --- disas.c | 6 ------ target-lm32/cpu.c | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/disas.c b/disas.c index 9459505..f269cc9 100644 --- a/disas.c +++ b/disas.c @@ -250,9 +250,6 @@ void target_disas(FILE *out, CPUState *cpu, target_ulong code, #elif defined(TARGET_ALPHA) s.info.mach = bfd_mach_alpha_ev6; s.info.print_insn = print_insn_alpha; -#elif defined(TARGET_LM32) - s.info.mach = bfd_mach_lm32; - s.info.print_insn = print_insn_lm32; #endif if (s.info.print_insn == NULL) { s.info.print_insn = print_insn_od_target; @@ -460,9 +457,6 @@ void monitor_disas(Monitor *mon, CPUState *cpu, #elif defined(TARGET_SH4) s.info.mach = bfd_mach_sh4; s.info.print_insn = print_insn_sh; -#elif defined(TARGET_LM32) - s.info.mach = bfd_mach_lm32; - s.info.print_insn = print_insn_lm32; #endif if (!s.info.print_insn) { monitor_printf(mon, "0x" TARGET_FMT_lx diff --git a/target-lm32/cpu.c b/target-lm32/cpu.c index c2b77c6..f9080ef 100644 --- a/target-lm32/cpu.c +++ b/target-lm32/cpu.c @@ -131,6 +131,12 @@ static void lm32_cpu_reset(CPUState *s) tlb_flush(s, 1); } +static void lm32_cpu_disas_set_info(CPUState *cpu, disassemble_info *info) +{ + info->mach = bfd_mach_lm32; + info->print_insn = print_insn_lm32; +} + static void lm32_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); @@ -275,6 +281,8 @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data) cc->gdb_num_core_regs = 32 + 7; cc->gdb_stop_before_watchpoint = true; cc->debug_excp_handler = lm32_debug_excp_handler; + + cc->disas_set_info = lm32_cpu_disas_set_info; } static void lm32_register_cpu_type(const LM32CPUInfo *info)