From patchwork Fri Jun 7 15:37:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 166179 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp896390ili; Fri, 7 Jun 2019 10:10:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTzeKeM2zKluCBFqwou0wHuZR6DNsTH5cU9WhYbYHuE5xVeAa4VqLpEf7rcbNxe9ffWDSB X-Received: by 2002:ac8:1751:: with SMTP id u17mr33205008qtk.305.1559927423188; Fri, 07 Jun 2019 10:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559927423; cv=none; d=google.com; s=arc-20160816; b=sTokQWpzi8GOugx46TeHtFcc7YMfA5WE4fZD/4F344PvTwK8kh9g16mRRtlI4xLz3Y P4BkjOHyOygHq/1O+aKL/4mGjfXMlBAF9LWzHRc/ckXXQoPPWvxF+5oqG374i2EN9ek5 TvAd9XBgKQ3VrheNyKKMALx7lLAhhMBmxgxG7CJn/bgMmXYnIUaR6q0DIcrKUeE3uqd1 3nq+pIJfeSsoYfuOJ5FEdkOM4QaXy9XiJBWSALQ/oFVpEw/iSKnoGienAJyVn1yj2mIn tk60IocQ+/ivcfOoA9zTJptHRr1mY8vhDwjXL7+7cfYYZFONofj+NeCICb9rj3v9w7RN qP9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=zRn4K2xRQOuoqH211bU4Zf9s4Z36VUpnuRoTC1Mq4p4=; b=EoFilLkb0f+WBe0QjK4vWRFbGq1yOsBGAnISoD7WppF7jv7d7CaG7SDG0npyYMyoYU OsoRfIkFw0ZOldWTJl2lAD2TTjcDVElVOJ0wR8oETnUcr7ZfR2Fg4EAKyhR6AaKsAkOW vndET8epbxBZIgiOEX02aMB6tJN6HKPDBgYx1OjPyrbKgAPg2rpFAcl3JnPvw5Q0CQQM FpiB01Z9GdX3KTQo/Lz3EZZ7hu1W6CQL2qwfOfM4ncHaS5tFi4cTykczpcwGZCmIVM9T 0JH+whCiITV03sA31dAfF084ch7euKbmvN9poRbI6gCUWnD1j1D6ai4yy8tdqs6eeu6/ xcLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p45si1640022qvf.13.2019.06.07.10.10.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 10:10:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:49678 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZINi-0007EX-PQ for patch@linaro.org; Fri, 07 Jun 2019 13:10:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53453) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZGzy-0003ZH-Cq for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:41:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZGwq-0001Z9-J2 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:38:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36096) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hZGwq-0001Wp-BK for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:38:32 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1DAAC3001702; Fri, 7 Jun 2019 15:38:31 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2752498BD; Fri, 7 Jun 2019 15:38:26 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Yoshinori Sato , qemu-devel@nongnu.org, Igor Mammedov , Richard Henderson Date: Fri, 7 Jun 2019 17:37:10 +0200 Message-Id: <20190607153725.18055-15-philmd@redhat.com> In-Reply-To: <20190607153725.18055-1-philmd@redhat.com> References: <20190607153725.18055-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 07 Jun 2019 15:38:31 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v18 14/29] target/rx: Convert to CPUClass::tlb_fill X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The interface for tlb_fill has changed very recently. Move the function into cpu.c so that it may be static while assigning to the CPUClass methods. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Yoshinori Sato Message-Id: <20190607091116.49044-12-ysato@users.sourceforge.jp> Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/rx/cpu.c | 14 ++++++++++++++ target/rx/op_helper.c | 11 ----------- 2 files changed, 14 insertions(+), 11 deletions(-) -- 2.20.1 diff --git a/target/rx/cpu.c b/target/rx/cpu.c index c370f65faa..3eef1329a1 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -154,6 +154,19 @@ static void rx_cpu_disas_set_info(CPUState *cpu, disassemble_info *info) info->print_insn = print_insn_rx; } +static bool rx_cpu_tlb_fill(CPUState *cs, vaddr addr, int size, + MMUAccessType access_type, int mmu_idx, + bool probe, uintptr_t retaddr) +{ + uint32_t address, physical, prot; + + /* Linear mapping */ + address = physical = addr & TARGET_PAGE_MASK; + prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; + tlb_set_page(cs, address, physical, prot, mmu_idx, TARGET_PAGE_SIZE); + return true; +} + static void rx_cpu_init(Object *obj) { CPUState *cs = CPU(obj); @@ -188,6 +201,7 @@ static void rx_cpu_class_init(ObjectClass *klass, void *data) cc->get_phys_page_debug = rx_cpu_get_phys_page_debug; cc->disas_set_info = rx_cpu_disas_set_info; cc->tcg_initialize = rx_translate_init; + cc->tlb_fill = rx_cpu_tlb_fill; cc->gdb_num_core_regs = 26; } diff --git a/target/rx/op_helper.c b/target/rx/op_helper.c index 9a460070e9..fb7ae3c3ec 100644 --- a/target/rx/op_helper.c +++ b/target/rx/op_helper.c @@ -468,14 +468,3 @@ void QEMU_NORETURN helper_rxbrk(CPURXState *env) { raise_exception(env, 0x100, 0); } - -void tlb_fill(CPUState *cs, target_ulong addr, int size, - MMUAccessType access_type, int mmu_idx, uintptr_t retaddr) -{ - uint32_t address, physical, prot; - - /* Linear mapping */ - address = physical = addr & TARGET_PAGE_MASK; - prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; - tlb_set_page(cs, address, physical, prot, mmu_idx, TARGET_PAGE_SIZE); -} From patchwork Fri Jun 7 15:37:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 166178 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp895883ili; Fri, 7 Jun 2019 10:09:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBpVUXeB+nfak7VqD9Dkro86AbiKmXTm0btxgc3Lkq9BT40TBWTGxD0p2DgKNTmMgMImIj X-Received: by 2002:a05:620a:69c:: with SMTP id f28mr26312040qkh.274.1559927398355; Fri, 07 Jun 2019 10:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559927398; cv=none; d=google.com; s=arc-20160816; b=hTFr2D1gtP1tBmQig6rRvEqPGTDKMbZMcbn0akvvVFRYrPxZvUTzHq2ubrpVFKVzG7 sen3q3D7PpWgmHRZO0P+M22xugcA0o9u1529f5qc3/1ke4sCsANHrt+7QSExcIiB/iPB XboZIrRu9hB+3iroKnDUDwIZHNQKzwUdJIlyp9vk8sxexoOpbf958WSfLIHRLJ5MO7p+ h/zFa3MDDO7IfN08lTuXSZLQZv7y3m7KkvZiFqxQaFUZMB0sPqVPXhl0EwVYlfxl5SOs L0O5mLypMEq7gCKA3Dz/RqNJnMpcyiYABlkKDss2ASaMSmT5tOlKD5bwUFuRvDH15z7b fj0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=vlsFjvCYYUmAe1QVq2AANeGugr3L3jP4ULf9+PYmmyA=; b=YFjmvaUsyl8L3ZvKhyimTj48y0le3hG3NawGydzsugeSz+WfOXw7qinBMl6rgsaNvx rkO6D/hMm9ugCarxC9b1mkxRVKmH9zsdzq0NRmOauVWKfZtilySVEphbNTnLJl/1u1c9 E143MsdKljfgIsScL+OYsb4KcZAqdtYo1jE2w//5YO3dTnuiY13a363yBRF4x1Tp7h0R suoVRKylR5BAIybl3KGe+yiokiZDjO5B+Y8ZQcvWCZC3RTnOo9T5QxKeDm/93YKJajig r+3VvIq2pbx6CGdD0+QHEHMGNBkXbCIDFyFR/UHj+RnGOlXbryTEsZJwH7TqrIxZAhsr 1NrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m91si554032qte.163.2019.06.07.10.09.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 10:09:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:49676 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZINJ-0005wO-WF for patch@linaro.org; Fri, 07 Jun 2019 13:09:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53997) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZGzx-0003ty-6V for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:41:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZGx2-0001rM-KW for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:38:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60752) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hZGwt-0001dJ-Lr for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:38:37 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0054EC18B2F7; Fri, 7 Jun 2019 15:38:34 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C21198BD; Fri, 7 Jun 2019 15:38:31 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Yoshinori Sato , qemu-devel@nongnu.org, Igor Mammedov , Richard Henderson Date: Fri, 7 Jun 2019 17:37:11 +0200 Message-Id: <20190607153725.18055-16-philmd@redhat.com> In-Reply-To: <20190607153725.18055-1-philmd@redhat.com> References: <20190607153725.18055-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 07 Jun 2019 15:38:34 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v18 15/29] target/rx: Add RX to SysEmuTarget X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Markus Armbruster Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Fixes check-qtest-rx: tests/qmp-cmd-test Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Yoshinori Sato Message-Id: <20190607091116.49044-13-ysato@users.sourceforge.jp> Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- qapi/common.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/qapi/common.json b/qapi/common.json index 99d313ef3b..d0fc931159 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -183,6 +183,7 @@ # is true even for "qemu-system-x86_64". # # ppcemb: dropped in 3.1 +# rx: added in 4.1 # # Since: 3.0 ## @@ -190,6 +191,6 @@ 'data' : [ 'aarch64', 'alpha', 'arm', 'cris', 'hppa', 'i386', 'lm32', 'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64', 'mips64el', 'mipsel', 'moxie', 'nios2', 'or1k', 'ppc', - 'ppc64', 'riscv32', 'riscv64', 's390x', 'sh4', + 'ppc64', 'riscv32', 'riscv64', 'rx', 's390x', 'sh4', 'sh4eb', 'sparc', 'sparc64', 'tricore', 'unicore32', 'x86_64', 'xtensa', 'xtensaeb' ] } From patchwork Fri Jun 7 15:37:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 166175 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp882624ili; Fri, 7 Jun 2019 09:59:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzeNYo4XcDIey35qpGFHlKyNOsN9l057mSCbtkdvl4ghlM4KWACjIfvNm6cZsQTfO9QgoEr X-Received: by 2002:a37:6043:: with SMTP id u64mr45059671qkb.9.1559926748603; Fri, 07 Jun 2019 09:59:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559926748; cv=none; d=google.com; s=arc-20160816; b=sFMI3kEvJk/Z26UOwI6+cHrbtuajK+dNLF1WE0Z3ZVmBLGcj9g8Jy80pBYJ3fOf6Lc +/dy8wYEm1oipwZ8c/OrlptMQyE0TyBKAVsBwdlfIDQSQGnGFMf9ByyDIwQgxWAkG3xE 33RKGBp3sI7s9n/tPP9mSXUNMcyU4DMqYs3kkW+X9mH5mXeQYlAisypMAyeSsAUBUGbO MkoKpLa0Q40qj97DdDU8NAYD+1BlWrhxDUBT6X/Us5N2oUMiU33RDUn+Lsqza1akUXbu ZbtZ+mTO9fkuNHqMyeI85wD5ZNC7Nu6GftRugP4uZjQT1aVI7CmEABGXeTlkgsbBVayP +Ilg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=uYSNvvzUcplZ41wDH+mAbKLkFcHA5l9Mc8YoGuUvOiQ=; b=Bmh+vI8nrHekU9amcq9A8R+cUa6N8NL8rFmogcOb4e80GGyeWSzsNI6TMHDmGGaiej sCU6C0ZZPFaKhW+9jm86gMg3GwhF1dO2DVRycg2ZoHMICZ1bod+p9b0wXg7IyPVA6lgt KrJ2ULU+btNqQOlbsyCCNq4COmHPV4Ydy/sKTJkPSYtTi+4qS/3MUZGRdzOZnoLp46IV fOljHfBf1XRd93N6nmPzAd4SEgvHw2seW/96pRJ1pU3Ay60/Wk/4YT/rfJ40H0qPmrVJ SNCV0JPGUMqBAqyAzuF1UWevdeDg8Kq0mGDM0Ly+3ORHUbMzpdNCY68geLGzLYhYKjzx I4cw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u23si652564qtq.369.2019.06.07.09.59.08 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 09:59:08 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:49616 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZICq-0006Rr-6R for patch@linaro.org; Fri, 07 Jun 2019 12:59:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53427) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZGzx-0003ZC-MB for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:41:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZGxA-0001zu-22 for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:38:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59108) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hZGx8-0001jX-HF for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:38:51 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A5A9C792AE; Fri, 7 Jun 2019 15:38:38 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 730EE8088F; Fri, 7 Jun 2019 15:38:34 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Yoshinori Sato , qemu-devel@nongnu.org, Igor Mammedov , Richard Henderson Date: Fri, 7 Jun 2019 17:37:12 +0200 Message-Id: <20190607153725.18055-17-philmd@redhat.com> In-Reply-To: <20190607153725.18055-1-philmd@redhat.com> References: <20190607153725.18055-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 07 Jun 2019 15:38:38 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v18 16/29] tests: Add rx to machine-none-test.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Paolo Bonzini , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Fixes check-qtest-rx: tests/machine-none-test. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Yoshinori Sato Message-Id: <20190607091116.49044-15-ysato@users.sourceforge.jp> Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tests/machine-none-test.c | 1 + 1 file changed, 1 insertion(+) -- 2.20.1 diff --git a/tests/machine-none-test.c b/tests/machine-none-test.c index 4c6d470798..80df277357 100644 --- a/tests/machine-none-test.c +++ b/tests/machine-none-test.c @@ -56,6 +56,7 @@ static struct arch2cpu cpus_map[] = { { "hppa", "hppa" }, { "riscv64", "rv64gcsu-v1.10.0" }, { "riscv32", "rv32gcsu-v1.9.1" }, + { "rx", "rx62n" }, }; static const char *get_cpu_model_by_arch(const char *arch) From patchwork Fri Jun 7 15:37:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 166180 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp902515ili; Fri, 7 Jun 2019 10:15:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOpPckMQdkQAyWhGqyFfDLu0mA/SHhKq9arRyTmZPqPzfH2jRSZ13DHMQMtNheau2CnFfQ X-Received: by 2002:ac8:16ac:: with SMTP id r41mr47581284qtj.346.1559927750292; Fri, 07 Jun 2019 10:15:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559927750; cv=none; d=google.com; s=arc-20160816; b=y+FGcoHfD8MKgojjJ5ZvC+r12rZZrG/UxSR4IHuYo9jRZFNx3kZ3REuVsG3r6v+1aT ZXR7vAfugFZMVN+kUN4ISGTcmS7oT9GJagrQ2n0cas0zqVA+QR+XMNGVSDGW+bHp7DcG TdjzsaiAgF07G7Z00W/I9aYABNjnASG9YSnvM2cFzHAMfu4dktzGXkEa1YyBFIn1JULp 4Iw6j7dLSuc+bsR855Vk0I7J2xOmAGYl08A3jQpxoMdy4X24LcaPfZVQnjSDsPzQNADM hr2LwPGdqO4Kg9v5pDzzHmTYgkqMqsLUmJs8lC2JPlX1OUYqBq8I9v+3UI6T26AcvbZx pm9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=vhnE0AsdyiR/wuoDtVF/kwyrZo1KctYnCMeE3cdtdoQ=; b=vJHD+8j1FfRvgbI1zeliL30yagr9Jty++9cwC0YcxMenfBNr0LpJHV2pujID9hWfP+ F+8OIhdGfL/sSIU9vPTIAwDU7BptrteDLfpy6Ownzrzf2NtJh+9+0XIVSfAVcF8/h4I/ aqwBG9Qpj9ewZr6wpuXMNL6YP02p3/E8hmKTjAq7U/ugrUMh5Lmtl7qlS/jg6+AIwavq /E0oUEG7yCLbPBlcdd+wNCW3OAgiBUYCcbi081KblTTKLKRK+VJAf2QMNURx3yrmjF76 SlZyuJ3aG7Cz/H7vkl2xOcvfnRUgfZiXhJGQWOjs73N/B8x/9D2UWI1Mcm6dNeSqnWNr L3Iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q5si1667459qke.271.2019.06.07.10.15.50 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 10:15:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:49720 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZISz-0002xq-Ob for patch@linaro.org; Fri, 07 Jun 2019 13:15:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53389) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZGzx-0003Yj-4a for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:41:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZGxA-00020N-Fo for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:38:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47238) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hZGxA-0001oJ-8o for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:38:52 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EFB14307CDD5; Fri, 7 Jun 2019 15:38:41 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38702808A7; Fri, 7 Jun 2019 15:38:38 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Yoshinori Sato , qemu-devel@nongnu.org, Igor Mammedov , Richard Henderson Date: Fri, 7 Jun 2019 17:37:13 +0200 Message-Id: <20190607153725.18055-18-philmd@redhat.com> In-Reply-To: <20190607153725.18055-1-philmd@redhat.com> References: <20190607153725.18055-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 07 Jun 2019 15:38:42 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v18 17/29] hw/rx: Honor -accel qtest X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Issue an error if no kernel, no bios, and not qtest'ing. Fixes make check-qtest-rx: test/qom-test. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Yoshinori Sato Message-Id: <20190607091116.49044-16-ysato@users.sourceforge.jp> Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- hw/rx/rx62n.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/hw/rx/rx62n.c b/hw/rx/rx62n.c index 3a8fe7b0bf..e55257c622 100644 --- a/hw/rx/rx62n.c +++ b/hw/rx/rx62n.c @@ -21,11 +21,13 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "hw/rx/rx62n.h" #include "hw/loader.h" #include "hw/sysbus.h" #include "sysemu/sysemu.h" +#include "sysemu/qtest.h" #include "cpu.h" /* @@ -190,8 +192,14 @@ static void rx62n_realize(DeviceState *dev, Error **errp) memory_region_init_rom(&s->c_flash, NULL, "codeflash", RX62N_CFLASH_SIZE, errp); memory_region_add_subregion(s->sysmem, RX62N_CFLASH_BASE, &s->c_flash); + if (!s->kernel) { - rom_add_file_fixed(bios_name, RX62N_CFLASH_BASE, 0); + if (bios_name) { + rom_add_file_fixed(bios_name, RX62N_CFLASH_BASE, 0); + } else if (!qtest_enabled()) { + error_report("No bios or kernel specified"); + exit(1); + } } object_initialize_child(OBJECT(s), "cpu", &s->cpu, From patchwork Fri Jun 7 15:37:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 166174 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp880948ili; Fri, 7 Jun 2019 09:57:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqzL/LHKYDZ6zu5yrRwJzKyo/QtpGcaIcAG1z5dAw9IFG5DeGi98ekmUDvHMWLPVJBHxrruX X-Received: by 2002:ac8:5297:: with SMTP id s23mr9111805qtn.230.1559926641456; Fri, 07 Jun 2019 09:57:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559926641; cv=none; d=google.com; s=arc-20160816; b=omde+/BxC1odFibjzxU/9ymlwmahqkmsJ2DjuAHLamWfNY6Qytq8xpp0xoAq0Ji1Lw +ZGr3orrODPp+2waq6RbGkWc3BhyiKfLK/Jxsb2blJBVwHzDi+9HjcFPrMtuMxH5BJIz QUTQ/xoWZD63Uydk21itNnsGTznxUWTvON25NXM2TvF2AtX7nxy08E7N7IF6KPwAetVw 5zcRrOX32yUxNq78T1rI1VgxvASip2uAFmRdeTPplgzqw+8Acbul9D70o1f8qYw9sZGc 75k+ggPMNyK6b1kfl8GjFvevuDtbmU77OtA8BYTXkqGqteIfki2e0fELwMUWzw7WPf3j PJ/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=Sgdo76gvbPkRQQZ+JZOWnZpm0cyBZ+UiKG5pJTMw9+g=; b=z1PUY7HOj4/vEGbSw/FT04X6pE77G0xzUPRyRwoN9I5xSMOkPExcct2+AwNVOSkVYv IYpueNjwis47nZwLa8Fn5wvHRRQFKOLC4HK0C4hMqVTt53Ca7PVrNHsXO/1ehGlpcoNf vEZoqQ/L6W6b78Ror8QkPPD7ejpNUxQRq3QnFH0eSJog9h7oLaziz+ZHEFCwTrlEdx1p j/wJgEe4uLSaEqpl9DFqwNXC49F5ULTj0KhW/OTxRO0NaNnYA0Gr8JlaTHvzHqy43Dd4 YS2SqkxVbivN+ysW12HlnL59Y8HRrrgItGcbJQH+XowttxViBBuEbzSJSC4LhiUFPTth wrOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x129si1557503qkd.207.2019.06.07.09.57.21 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 09:57:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:49602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZIB7-0004rA-1i for patch@linaro.org; Fri, 07 Jun 2019 12:57:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53686) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZGzw-0003i0-MW for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:41:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZGxV-0002Wg-Oc for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:39:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52970) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hZGxT-0002Ru-6a for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:39:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6DDB2C00DE0C; Fri, 7 Jun 2019 15:39:04 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C883880883; Fri, 7 Jun 2019 15:38:57 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Yoshinori Sato , qemu-devel@nongnu.org, Igor Mammedov , Richard Henderson Date: Fri, 7 Jun 2019 17:37:16 +0200 Message-Id: <20190607153725.18055-21-philmd@redhat.com> In-Reply-To: <20190607153725.18055-1-philmd@redhat.com> References: <20190607153725.18055-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 07 Jun 2019 15:39:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v18 20/29] target/rx: Disassemble rx_index_addr into a string X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We were eliding all zero indexes. It is only ld==0 that does not have an index in the instruction. This also allows us to avoid breaking the final print into multiple pieces. Reviewed-by: Yoshinori Sato Signed-off-by: Yoshinori Sato Message-Id: <20190607091116.49044-19-ysato@users.sourceforge.jp> Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/rx/disas.c | 154 +++++++++++++++++----------------------------- 1 file changed, 55 insertions(+), 99 deletions(-) -- 2.20.1 diff --git a/target/rx/disas.c b/target/rx/disas.c index 8cada4825d..64342537ee 100644 --- a/target/rx/disas.c +++ b/target/rx/disas.c @@ -107,49 +107,42 @@ static const char psw[] = { 'i', 'u', 0, 0, 0, 0, 0, 0, }; -static uint32_t rx_index_addr(int ld, int size, DisasContext *ctx) +static void rx_index_addr(DisasContext *ctx, char out[8], int ld, int mi) { - bfd_byte buf[2]; + uint32_t addr = ctx->addr; + uint8_t buf[2]; + uint16_t dsp; + switch (ld) { case 0: - return 0; + /* No index; return empty string. */ + out[0] = '\0'; + return; case 1: - ctx->dis->read_memory_func(ctx->addr, buf, 1, ctx->dis); ctx->addr += 1; - return ((uint8_t)buf[0]) << size; + ctx->dis->read_memory_func(addr, buf, 1, ctx->dis); + dsp = buf[0]; + break; case 2: - ctx->dis->read_memory_func(ctx->addr, buf, 2, ctx->dis); ctx->addr += 2; - return lduw_le_p(buf) << size; + ctx->dis->read_memory_func(addr, buf, 2, ctx->dis); + dsp = lduw_le_p(buf); + break; + default: + g_assert_not_reached(); } - g_assert_not_reached(); + + sprintf(out, "%u", dsp << (mi < 3 ? mi : 4 - mi)); } static void operand(DisasContext *ctx, int ld, int mi, int rs, int rd) { - int dsp; static const char sizes[][4] = {".b", ".w", ".l", ".uw", ".ub"}; + char dsp[8]; + if (ld < 3) { - switch (mi) { - case 4: - /* dsp[rs].ub */ - dsp = rx_index_addr(ld, RX_MEMORY_BYTE, ctx); - break; - case 3: - /* dsp[rs].uw */ - dsp = rx_index_addr(ld, RX_MEMORY_WORD, ctx); - break; - default: - /* dsp[rs].b */ - /* dsp[rs].w */ - /* dsp[rs].l */ - dsp = rx_index_addr(ld, mi, ctx); - break; - } - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d]%s", rs, sizes[mi]); + rx_index_addr(ctx, dsp, ld, mi); + prt("%s[r%d]%s", dsp, rs, sizes[mi]); } else { prt("r%d", rs); } @@ -235,7 +228,7 @@ static bool trans_MOV_ra(DisasContext *ctx, arg_MOV_ra *a) /* mov.[bwl] rs,rd */ static bool trans_MOV_mm(DisasContext *ctx, arg_MOV_mm *a) { - int dsp; + char dspd[8], dsps[8]; prt("mov.%c\t", size[a->sz]); if (a->lds == 3 && a->ldd == 3) { @@ -244,29 +237,15 @@ static bool trans_MOV_mm(DisasContext *ctx, arg_MOV_mm *a) return true; } if (a->lds == 3) { - prt("r%d, ", a->rd); - dsp = rx_index_addr(a->ldd, a->sz, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d]", a->rs); + rx_index_addr(ctx, dspd, a->ldd, a->sz); + prt("r%d, %s[r%d]", a->rs, dspd, a->rd); } else if (a->ldd == 3) { - dsp = rx_index_addr(a->lds, a->sz, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d], r%d", a->rs, a->rd); + rx_index_addr(ctx, dsps, a->lds, a->sz); + prt("%s[r%d], r%d", dsps, a->rs, a->rd); } else { - dsp = rx_index_addr(a->lds, a->sz, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d], ", a->rs); - dsp = rx_index_addr(a->ldd, a->sz, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d]", a->rd); + rx_index_addr(ctx, dsps, a->lds, a->sz); + rx_index_addr(ctx, dspd, a->ldd, a->sz); + prt("%s[r%d], %s[r%d]", dsps, a->rs, dspd, a->rd); } return true; } @@ -357,12 +336,10 @@ static bool trans_PUSH_r(DisasContext *ctx, arg_PUSH_r *a) /* push dsp[rs] */ static bool trans_PUSH_m(DisasContext *ctx, arg_PUSH_m *a) { - prt("push\t"); - int dsp = rx_index_addr(a->ld, a->sz, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d]", a->rs); + char dsp[8]; + + rx_index_addr(ctx, dsp, a->ld, a->sz); + prt("push\t%s[r%d]", dsp, a->rs); return true; } @@ -389,17 +366,13 @@ static bool trans_XCHG_rr(DisasContext *ctx, arg_XCHG_rr *a) /* xchg dsp[rs].,rd */ static bool trans_XCHG_mr(DisasContext *ctx, arg_XCHG_mr *a) { - int dsp; static const char msize[][4] = { "b", "w", "l", "ub", "uw", }; + char dsp[8]; - prt("xchg\t"); - dsp = rx_index_addr(a->ld, a->mi, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d].%s, r%d", a->rs, msize[a->mi], a->rd); + rx_index_addr(ctx, dsp, a->ld, a->mi); + prt("xchg\t%s[r%d].%s, r%d", dsp, a->rs, msize[a->mi], a->rd); return true; } @@ -552,13 +525,10 @@ static bool trans_ADC_rr(DisasContext *ctx, arg_ADC_rr *a) /* adc dsp[rs], rd */ static bool trans_ADC_mr(DisasContext *ctx, arg_ADC_mr *a) { - int dsp; - prt("adc\t"); - dsp = rx_index_addr(a->ld, 2, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d], r%d", a->rs, a->rd); + char dsp[8]; + + rx_index_addr(ctx, dsp, a->ld, 2); + prt("adc\t%s[r%d], r%d", dsp, a->rs, a->rd); return true; } @@ -1217,25 +1187,17 @@ static bool trans_ITOF(DisasContext *ctx, arg_ITOF *a) #define BOP_IM(name, reg) \ do { \ - int dsp; \ - prt("b%s\t#%d, ", #name, a->imm); \ - dsp = rx_index_addr(a->ld, RX_MEMORY_BYTE, ctx); \ - if (dsp > 0) { \ - prt("%d", dsp); \ - } \ - prt("[r%d]", reg); \ + char dsp[8]; \ + rx_index_addr(ctx, dsp, a->ld, RX_MEMORY_BYTE); \ + prt("b%s\t#%d, %s[r%d]", #name, a->imm, dsp, reg); \ return true; \ } while (0) #define BOP_RM(name) \ do { \ - int dsp; \ - prt("b%s\tr%d, ", #name, a->rd); \ - dsp = rx_index_addr(a->ld, RX_MEMORY_BYTE, ctx); \ - if (dsp > 0) { \ - prt("%d", dsp); \ - } \ - prt("[r%d]", a->rs); \ + char dsp[8]; \ + rx_index_addr(ctx, dsp, a->ld, RX_MEMORY_BYTE); \ + prt("b%s\tr%d, %s[r%d]", #name, a->rd, dsp, a->rs); \ return true; \ } while (0) @@ -1346,12 +1308,10 @@ static bool trans_BNOT_ir(DisasContext *ctx, arg_BNOT_ir *a) /* bmcond #imm, dsp[rd] */ static bool trans_BMCnd_im(DisasContext *ctx, arg_BMCnd_im *a) { - int dsp = rx_index_addr(a->ld, RX_MEMORY_BYTE, ctx); - prt("bm%s\t#%d, ", cond[a->cd], a->imm); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[%d]", a->rd); + char dsp[8]; + + rx_index_addr(ctx, dsp, a->ld, RX_MEMORY_BYTE); + prt("bm%s\t#%d, %s[r%d]", cond[a->cd], a->imm, dsp, a->rd); return true; } @@ -1443,16 +1403,12 @@ static bool trans_WAIT(DisasContext *ctx, arg_WAIT *a) /* sccnd.[bwl] dsp:[rd] */ static bool trans_SCCnd(DisasContext *ctx, arg_SCCnd *a) { - int dsp; - prt("sc%s.%c\t", cond[a->cd], size[a->sz]); if (a->ld < 3) { - dsp = rx_index_addr(a->sz, a->ld, ctx); - if (dsp > 0) { - prt("%d", dsp); - } - prt("[r%d]", a->rd); + char dsp[8]; + rx_index_addr(ctx, dsp, a->sz, a->ld); + prt("sc%s.%c\t%s[r%d]", cond[a->cd], size[a->sz], dsp, a->rd); } else { - prt("r%d", a->rd); + prt("sc%s.%c\tr%d", cond[a->cd], size[a->sz], a->rd); } return true; } From patchwork Fri Jun 7 15:37:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 166182 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp916424ili; Fri, 7 Jun 2019 10:27:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhveQdNnlImaxvPBSrmUMrpueXDGr5NXhHYIvb4wS0XoTXSNtR60BiWZqAY86Vtr+CV/89 X-Received: by 2002:aed:3a03:: with SMTP id n3mr14425659qte.85.1559928479769; Fri, 07 Jun 2019 10:27:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559928479; cv=none; d=google.com; s=arc-20160816; b=LeGoSHXpYg7p2WFoLHck54hVM1++zo+bHLmOgLkTGNG1Eve34HajG8ph5IIniBO+sm K92bJdn4hQbHaAhoz6FFZQXAvZ4iY5YqWpKA1LvIVTaUwwsLzZ2ewhc+T8HRlijFq7tH 2Sd7zu0mf3vqvv/JqulxCThZXlYQ8m2pUJRVprm5EKLK/blniOdVmuQFvy4XUogJMKXj hB8HcGnqZOthNR+/lPf6B5iFJed+qj+yuce+aO2XktSPhBYBeN1yPvySiDKayrbtOrZG xA8zFPCEfXvw2R5qTPcDZ1sGEsngz8rTSOmGQlc7bjRcr/wZKg8aWGHguELfJqmZwlyy RIAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=vw0gLml6GKKdwWn024UJOrJouescxVwiiTcyvJzkU+Y=; b=0PGj8ONM9MZoUmL8HtcMm425394uqL2IbQjIH0zCGdiQuSNfB8ATlGKQxRtLE00S10 od3rvkpn/iLj8VFjf1MtL8XoaICHzLivWFQ8EqSDyy+Lv+uoIPw6REOZaNCdAN0fVoSM eYvDEevXdZ0xhnklq/3mctezOFA6ZTWgreCQ8hVdzj+VLtb77BbdF8TOD27wR8yW7vkO kvYfK9VaNVQUbrUAR2fR7JxeiisSJv//2/goeOvLa15zppSsVJDzBcyiK0k9yjngv0Ku P4qGV0tXAntoRZ76Cmxg7LTWw0Vv9lw5o2H/YpbwmbXj8SR2wh7PIVGGmWT3R18FveeA bL7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h41si107629qta.179.2019.06.07.10.27.59 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 10:27:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:49778 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZIel-0002LC-CD for patch@linaro.org; Fri, 07 Jun 2019 13:27:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53398) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZGzw-0003Yu-2p for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:41:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZGxe-0002gw-1A for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:39:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47308) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hZGxa-0002Xj-6j for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:39:18 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C5A7305E246; Fri, 7 Jun 2019 15:39:13 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F12F47FE9A; Fri, 7 Jun 2019 15:39:04 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Yoshinori Sato , qemu-devel@nongnu.org, Igor Mammedov , Richard Henderson Date: Fri, 7 Jun 2019 17:37:17 +0200 Message-Id: <20190607153725.18055-22-philmd@redhat.com> In-Reply-To: <20190607153725.18055-1-philmd@redhat.com> References: <20190607153725.18055-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 07 Jun 2019 15:39:13 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v18 21/29] target/rx: Replace operand with prt_ldmi in disassembler X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This has consistency with prt_ri(). It loads all data before beginning output. It uses exactly one call to prt() to emit the full instruction. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Yoshinori Sato Signed-off-by: Yoshinori Sato Message-Id: <20190607091116.49044-20-ysato@users.sourceforge.jp> Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/rx/disas.c | 77 +++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 50 deletions(-) -- 2.20.1 diff --git a/target/rx/disas.c b/target/rx/disas.c index 64342537ee..515b365528 100644 --- a/target/rx/disas.c +++ b/target/rx/disas.c @@ -135,18 +135,18 @@ static void rx_index_addr(DisasContext *ctx, char out[8], int ld, int mi) sprintf(out, "%u", dsp << (mi < 3 ? mi : 4 - mi)); } -static void operand(DisasContext *ctx, int ld, int mi, int rs, int rd) +static void prt_ldmi(DisasContext *ctx, const char *insn, + int ld, int mi, int rs, int rd) { static const char sizes[][4] = {".b", ".w", ".l", ".uw", ".ub"}; char dsp[8]; if (ld < 3) { rx_index_addr(ctx, dsp, ld, mi); - prt("%s[r%d]%s", dsp, rs, sizes[mi]); + prt("%s\t%s[r%d]%s, r%d", insn, dsp, rs, sizes[mi], rd); } else { - prt("r%d", rs); + prt("%s\tr%d, r%d", insn, rs, rd); } - prt(", r%d", rd); } static void prt_ir(DisasContext *ctx, const char *insn, int imm, int rd) @@ -416,8 +416,7 @@ static bool trans_AND_ir(DisasContext *ctx, arg_AND_ir *a) /* and rs,rd */ static bool trans_AND_mr(DisasContext *ctx, arg_AND_mr *a) { - prt("and\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "and", a->ld, a->mi, a->rs, a->rd); return true; } @@ -440,8 +439,7 @@ static bool trans_OR_ir(DisasContext *ctx, arg_OR_ir *a) /* or rs,rd */ static bool trans_OR_mr(DisasContext *ctx, arg_OR_mr *a) { - prt("or\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "or", a->ld, a->mi, a->rs, a->rd); return true; } @@ -463,8 +461,7 @@ static bool trans_XOR_ir(DisasContext *ctx, arg_XOR_ir *a) /* xor rs,rd */ static bool trans_XOR_mr(DisasContext *ctx, arg_XOR_mr *a) { - prt("xor\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "xor", a->ld, a->mi, a->rs, a->rd); return true; } @@ -479,8 +476,7 @@ static bool trans_TST_ir(DisasContext *ctx, arg_TST_ir *a) /* tst rs, rd */ static bool trans_TST_mr(DisasContext *ctx, arg_TST_mr *a) { - prt("tst\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "tst", a->ld, a->mi, a->rs, a->rd); return true; } @@ -548,8 +544,7 @@ static bool trans_ADD_irr(DisasContext *ctx, arg_ADD_irr *a) /* add dsp[rs], rd */ static bool trans_ADD_mr(DisasContext *ctx, arg_ADD_mr *a) { - prt("add\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "add", a->ld, a->mi, a->rs, a->rd); return true; } @@ -573,8 +568,7 @@ static bool trans_CMP_ir(DisasContext *ctx, arg_CMP_ir *a) /* cmp dsp[rs], rs2 */ static bool trans_CMP_mr(DisasContext *ctx, arg_CMP_mr *a) { - prt("cmp\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "cmp", a->ld, a->mi, a->rs, a->rd); return true; } @@ -589,8 +583,7 @@ static bool trans_SUB_ir(DisasContext *ctx, arg_SUB_ir *a) /* sub dsp[rs], rd */ static bool trans_SUB_mr(DisasContext *ctx, arg_SUB_mr *a) { - prt("sub\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "sub", a->ld, a->mi, a->rs, a->rd); return true; } @@ -611,8 +604,7 @@ static bool trans_SBB_rr(DisasContext *ctx, arg_SBB_rr *a) /* sbb dsp[rs], rd */ static bool trans_SBB_mr(DisasContext *ctx, arg_SBB_mr *a) { - prt("sbb\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "sbb", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -640,8 +632,7 @@ static bool trans_MAX_ir(DisasContext *ctx, arg_MAX_ir *a) /* max dsp[rs], rd */ static bool trans_MAX_mr(DisasContext *ctx, arg_MAX_mr *a) { - prt("max\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "max", a->ld, a->mi, a->rs, a->rd); return true; } @@ -656,8 +647,7 @@ static bool trans_MIN_ir(DisasContext *ctx, arg_MIN_ir *a) /* min dsp[rs], rd */ static bool trans_MIN_mr(DisasContext *ctx, arg_MIN_mr *a) { - prt("max\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "min", a->ld, a->mi, a->rs, a->rd); return true; } @@ -673,8 +663,7 @@ static bool trans_MUL_ir(DisasContext *ctx, arg_MUL_ir *a) /* mul dsp[rs], rd */ static bool trans_MUL_mr(DisasContext *ctx, arg_MUL_mr *a) { - prt("mul\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "mul", a->ld, a->mi, a->rs, a->rd); return true; } @@ -696,8 +685,7 @@ static bool trans_EMUL_ir(DisasContext *ctx, arg_EMUL_ir *a) /* emul dsp[rs], rd */ static bool trans_EMUL_mr(DisasContext *ctx, arg_EMUL_mr *a) { - prt("emul\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "emul", a->ld, a->mi, a->rs, a->rd); return true; } @@ -712,8 +700,7 @@ static bool trans_EMULU_ir(DisasContext *ctx, arg_EMULU_ir *a) /* emulu dsp[rs], rd */ static bool trans_EMULU_mr(DisasContext *ctx, arg_EMULU_mr *a) { - prt("emulu\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "emulu", a->ld, a->mi, a->rs, a->rd); return true; } @@ -728,8 +715,7 @@ static bool trans_DIV_ir(DisasContext *ctx, arg_DIV_ir *a) /* div dsp[rs], rd */ static bool trans_DIV_mr(DisasContext *ctx, arg_DIV_mr *a) { - prt("div\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "div", a->ld, a->mi, a->rs, a->rd); return true; } @@ -744,8 +730,7 @@ static bool trans_DIVU_ir(DisasContext *ctx, arg_DIVU_ir *a) /* divu dsp[rs], rd */ static bool trans_DIVU_mr(DisasContext *ctx, arg_DIVU_mr *a) { - prt("divu\t"); - operand(ctx, a->ld, a->mi, a->rs, a->rd); + prt_ldmi(ctx, "divu", a->ld, a->mi, a->rs, a->rd); return true; } @@ -1089,8 +1074,7 @@ static bool trans_FADD_ir(DisasContext *ctx, arg_FADD_ir *a) /* fadd rs, rd */ static bool trans_FADD_mr(DisasContext *ctx, arg_FADD_mr *a) { - prt("fadd\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "fadd", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -1105,8 +1089,7 @@ static bool trans_FCMP_ir(DisasContext *ctx, arg_FCMP_ir *a) /* fcmp rs, rd */ static bool trans_FCMP_mr(DisasContext *ctx, arg_FCMP_mr *a) { - prt("fcmp\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "fcmp", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -1121,8 +1104,7 @@ static bool trans_FSUB_ir(DisasContext *ctx, arg_FSUB_ir *a) /* fsub rs, rd */ static bool trans_FSUB_mr(DisasContext *ctx, arg_FSUB_mr *a) { - prt("fsub\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "fsub", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -1130,8 +1112,7 @@ static bool trans_FSUB_mr(DisasContext *ctx, arg_FSUB_mr *a) /* ftoi rs, rd */ static bool trans_FTOI(DisasContext *ctx, arg_FTOI *a) { - prt("ftoi\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "ftoi", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -1146,8 +1127,7 @@ static bool trans_FMUL_ir(DisasContext *ctx, arg_FMUL_ir *a) /* fmul rs, rd */ static bool trans_FMUL_mr(DisasContext *ctx, arg_FMUL_mr *a) { - prt("fmul\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "fmul", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -1162,8 +1142,7 @@ static bool trans_FDIV_ir(DisasContext *ctx, arg_FDIV_ir *a) /* fdiv rs, rd */ static bool trans_FDIV_mr(DisasContext *ctx, arg_FDIV_mr *a) { - prt("fdiv\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "fdiv", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -1171,8 +1150,7 @@ static bool trans_FDIV_mr(DisasContext *ctx, arg_FDIV_mr *a) /* round rs, rd */ static bool trans_ROUND(DisasContext *ctx, arg_ROUND *a) { - prt("round\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "round", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } @@ -1180,8 +1158,7 @@ static bool trans_ROUND(DisasContext *ctx, arg_ROUND *a) /* itof dsp[rs], rd */ static bool trans_ITOF(DisasContext *ctx, arg_ITOF *a) { - prt("itof\t"); - operand(ctx, a->ld, RX_IM_LONG, a->rs, a->rd); + prt_ldmi(ctx, "itof", a->ld, RX_IM_LONG, a->rs, a->rd); return true; } From patchwork Fri Jun 7 15:37:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 166176 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp888102ili; Fri, 7 Jun 2019 10:03:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIY5EMuTadu6EJ2BGVuxvSwtkMzSl5ix7C+uYiJ+pIhBsilVEzS8HE1c/KHCyAZ460wzKi X-Received: by 2002:ac8:2dcf:: with SMTP id q15mr46242505qta.170.1559927019541; Fri, 07 Jun 2019 10:03:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559927019; cv=none; d=google.com; s=arc-20160816; b=frzBF/o4bEG05qDACVfm0llskcT86B8ZpH5qeIF4HoY/PAZyC12Q9VjZgivxkMLjTI nYKX3nRVZJ+x09FQZqYEXcmMYLJc0bcz/iknG/K0EcjTbhTu1nvaODUbtIbgfIvtwL7I asODeyeaomQoPh9srI+wmTMHIJgMc+tzjuDeB8Vi/vmtTHH6Gqcuguj79JZKcqnnIoXu 5xQXjN/H1Sv1H0s9aUng/XGQvbzgkblan5uEzCmTUtyuGH4vQZo7cR6PqO9gEq/YER0f dmEFMfUWtFXTR2ygph5arRKDbfKZl4alpxrefUGTLhgHvce3uxhoE2kcT6oMHLoIBiAH 4yWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=vBgmqVV1HHXMsA9aXkS1dhyBW4HB0voCVVWuH7KTmpU=; b=V4YFJtU1E67kHnB6a0a8IoBWsdiBl+lhB9c0mntZs1jsGCm32mHyZhd6yF73om0Tpl BcV+9k6trsYmiBw8ZUnKhvcbtvcfSGCglqNsEGyfKoPnuu52q3m+VP6SFx3jwcKj5Crc R8/xjPt4PpGVFL1oFVFm9FcA92msWm+sF+wPUuAV6LA4nUAoIpuhHc5T5mQaQFO08lBe UOEg7f5K2Q0fINbU9D/C6WFKMDPLC7nRenfzmcAVkzEtxTRZlfBDUjVMGz8Oigkw26wK HBwtMSZz5x7PThUf0wP6VpZluMEX7TjlCRl+T00DzJjzVDQFvfKMlloXOYTPC4WLX8Um Feeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r21si387271qtp.149.2019.06.07.10.03.39 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 10:03:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:49644 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZIHD-0001LW-4f for patch@linaro.org; Fri, 07 Jun 2019 13:03:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53427) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZGzu-0003ZC-Rc for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:41:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZGxl-0002qS-OY for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:39:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53734) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hZGxj-0002iD-NU for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:39:29 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 44B87C057F30; Fri, 7 Jun 2019 15:39:20 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3249E7FE99; Fri, 7 Jun 2019 15:39:13 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Yoshinori Sato , qemu-devel@nongnu.org, Igor Mammedov , Richard Henderson Date: Fri, 7 Jun 2019 17:37:18 +0200 Message-Id: <20190607153725.18055-23-philmd@redhat.com> In-Reply-To: <20190607153725.18055-1-philmd@redhat.com> References: <20190607153725.18055-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 07 Jun 2019 15:39:20 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v18 22/29] target/rx: Use prt_ldmi for XCHG_mr disassembly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Note that the ld == 3 case handled by prt_ldmi is decoded as XCHG_rr and cannot appear here. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Yoshinori Sato Signed-off-by: Yoshinori Sato Message-Id: <20190607091116.49044-21-ysato@users.sourceforge.jp> Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/rx/disas.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) -- 2.20.1 diff --git a/target/rx/disas.c b/target/rx/disas.c index 515b365528..db10385fd0 100644 --- a/target/rx/disas.c +++ b/target/rx/disas.c @@ -366,13 +366,7 @@ static bool trans_XCHG_rr(DisasContext *ctx, arg_XCHG_rr *a) /* xchg dsp[rs].,rd */ static bool trans_XCHG_mr(DisasContext *ctx, arg_XCHG_mr *a) { - static const char msize[][4] = { - "b", "w", "l", "ub", "uw", - }; - char dsp[8]; - - rx_index_addr(ctx, dsp, a->ld, a->mi); - prt("xchg\t%s[r%d].%s, r%d", dsp, a->rs, msize[a->mi], a->rd); + prt_ldmi(ctx, "xchg", a->ld, a->mi, a->rs, a->rd); return true; } From patchwork Fri Jun 7 15:37:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 166173 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp878253ili; Fri, 7 Jun 2019 09:54:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPqvSlrkvgpC/k9W6NNswYsO7XDHHb3dP2cBxXVNrmG2XEZa7C8fSmyCtZM3KLkB3wyF5o X-Received: by 2002:ac8:4705:: with SMTP id f5mr24494528qtp.99.1559926480558; Fri, 07 Jun 2019 09:54:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559926480; cv=none; d=google.com; s=arc-20160816; b=j+3kHOZtv8dshGo9hCfoZZGF6iwYymztxwHEQnFEUU71y03sNkaYAQbMQ3prom8o4U mW2dyy+A/0FcN0krMu7mbAmwVyYInSGUyZlNzSJhDymVOoCo9oU0amL3a5j14TOooUUT sQwW2za4UwsoK+13EUKPrIMAGGmYgSMw/EtwRADKPWjml5XVimbqQqgGiZ4sBMlZ2bIC wTNKjBwC/8kTrnHWtetG9+KyGXE3kCXp6dYWtFznv95CuORIhNLNjIgf7su81BBOZY8a pdjbYxH4ys0giNhBzfo5sbiFv50GCYv0N3MklZPUk1qfMnnUmDIp7Qc1AJwP8DT+BjSC P8pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=/s500mB5cnXJIsX9IKljur+jp56CjbsyHaOWGoXs1zo=; b=ihoSh2O0Sf+W8OdbxEZdKTgGlUAf3D8dz7/hkkNoD5hWKZ7Aga2498LlqLv/UodMmk a+pt7NDKmIqZc8MhylHMmo4lJVBEyeXH1PYM7kby8/wF4XhBYCU+beqMY7oKpF6kBbaX Eu4wrrMPoYVaEJ+Lbn6SsdYk9U71XnPmupcQ/cMjcdI+kRfrkMHFEbb2yrigUjlSDSmR H5K3PHCANJ7j6N7nqURoAgIx1lQRhdp9kzllkjQQZ35yyainDnYcojGiYshoUhThq79f bZd60Hm+ESU4uzf5ODZ9h5GE2aUByo2ZWOLOBJxWonpg2kw51NrrYL3YuZ4Trl/dhMiX yDRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z26si1544817qvg.99.2019.06.07.09.54.40 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 09:54:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:49588 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZI8W-0001xu-5M for patch@linaro.org; Fri, 07 Jun 2019 12:54:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53315) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZGzs-0003U0-Co for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:41:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZGxo-0002yZ-IO for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:39:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47982) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hZGxn-0002tR-Td for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:39:32 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7C8FC3086204; Fri, 7 Jun 2019 15:39:25 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CA3CF80881; Fri, 7 Jun 2019 15:39:20 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Yoshinori Sato , qemu-devel@nongnu.org, Igor Mammedov , Richard Henderson Date: Fri, 7 Jun 2019 17:37:19 +0200 Message-Id: <20190607153725.18055-24-philmd@redhat.com> In-Reply-To: <20190607153725.18055-1-philmd@redhat.com> References: <20190607153725.18055-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 07 Jun 2019 15:39:25 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v18 23/29] target/rx: Emit all disassembly in one prt() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Many of the multi-part prints have been eliminated by previous patches. Eliminate the rest of them. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Yoshinori Sato Signed-off-by: Yoshinori Sato Message-Id: <20190607091116.49044-22-ysato@users.sourceforge.jp> Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/rx/disas.c | 75 ++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 36 deletions(-) -- 2.20.1 diff --git a/target/rx/disas.c b/target/rx/disas.c index db10385fd0..ebc1a44249 100644 --- a/target/rx/disas.c +++ b/target/rx/disas.c @@ -228,24 +228,21 @@ static bool trans_MOV_ra(DisasContext *ctx, arg_MOV_ra *a) /* mov.[bwl] rs,rd */ static bool trans_MOV_mm(DisasContext *ctx, arg_MOV_mm *a) { - char dspd[8], dsps[8]; + char dspd[8], dsps[8], szc = size[a->sz]; - prt("mov.%c\t", size[a->sz]); if (a->lds == 3 && a->ldd == 3) { /* mov.[bwl] rs,rd */ - prt("r%d, r%d", a->rs, a->rd); - return true; - } - if (a->lds == 3) { + prt("mov.%c\tr%d, r%d", szc, a->rs, a->rd); + } else if (a->lds == 3) { rx_index_addr(ctx, dspd, a->ldd, a->sz); - prt("r%d, %s[r%d]", a->rs, dspd, a->rd); + prt("mov.%c\tr%d, %s[r%d]", szc, a->rs, dspd, a->rd); } else if (a->ldd == 3) { rx_index_addr(ctx, dsps, a->lds, a->sz); - prt("%s[r%d], r%d", dsps, a->rs, a->rd); + prt("mov.%c\t%s[r%d], r%d", szc, dsps, a->rs, a->rd); } else { rx_index_addr(ctx, dsps, a->lds, a->sz); rx_index_addr(ctx, dspd, a->ldd, a->sz); - prt("%s[r%d], %s[r%d]", dsps, a->rs, dspd, a->rd); + prt("mov.%c\t%s[r%d], %s[r%d]", szc, dsps, a->rs, dspd, a->rd); } return true; } @@ -254,8 +251,11 @@ static bool trans_MOV_mm(DisasContext *ctx, arg_MOV_mm *a) /* mov.[bwl] rs,[-rd] */ static bool trans_MOV_rp(DisasContext *ctx, arg_MOV_rp *a) { - prt("mov.%c\tr%d, ", size[a->sz], a->rs); - prt((a->ad == 0) ? "[r%d+]" : "[-r%d]", a->rd); + if (a->ad) { + prt("mov.%c\tr%d, [-r%d]", size[a->sz], a->rs, a->rd); + } else { + prt("mov.%c\tr%d, [r%d+]", size[a->sz], a->rs, a->rd); + } return true; } @@ -263,9 +263,11 @@ static bool trans_MOV_rp(DisasContext *ctx, arg_MOV_rp *a) /* mov.[bwl] [-rd],rs */ static bool trans_MOV_pr(DisasContext *ctx, arg_MOV_pr *a) { - prt("mov.%c\t", size[a->sz]); - prt((a->ad == 0) ? "[r%d+]" : "[-r%d]", a->rd); - prt(", r%d", a->rs); + if (a->ad) { + prt("mov.%c\t[-r%d], r%d", size[a->sz], a->rd, a->rs); + } else { + prt("mov.%c\t[r%d+], r%d", size[a->sz], a->rd, a->rs); + } return true; } @@ -299,9 +301,11 @@ static bool trans_MOVU_ar(DisasContext *ctx, arg_MOVU_ar *a) /* movu.[bw] [-rs],rd */ static bool trans_MOVU_pr(DisasContext *ctx, arg_MOVU_pr *a) { - prt("movu.%c\t", size[a->sz]); - prt((a->ad == 0) ? "[r%d+]" : "[-r%d]", a->rd); - prt(", r%d", a->rs); + if (a->ad) { + prt("movu.%c\t[-r%d], r%d", size[a->sz], a->rd, a->rs); + } else { + prt("movu.%c\t[r%d+], r%d", size[a->sz], a->rd, a->rs); + } return true; } @@ -478,11 +482,11 @@ static bool trans_TST_mr(DisasContext *ctx, arg_TST_mr *a) /* not rs, rd */ static bool trans_NOT_rr(DisasContext *ctx, arg_NOT_rr *a) { - prt("not\t"); if (a->rs != a->rd) { - prt("r%d, ", a->rs); + prt("not\tr%d, r%d", a->rs, a->rd); + } else { + prt("not\tr%d", a->rs); } - prt("r%d", a->rd); return true; } @@ -490,11 +494,11 @@ static bool trans_NOT_rr(DisasContext *ctx, arg_NOT_rr *a) /* neg rs, rd */ static bool trans_NEG_rr(DisasContext *ctx, arg_NEG_rr *a) { - prt("neg\t"); if (a->rs != a->rd) { - prt("r%d, ", a->rs); + prt("neg\tr%d, r%d", a->rs, a->rd); + } else { + prt("neg\tr%d", a->rs); } - prt("r%d", a->rd); return true; } @@ -606,11 +610,10 @@ static bool trans_SBB_mr(DisasContext *ctx, arg_SBB_mr *a) /* abs rs, rd */ static bool trans_ABS_rr(DisasContext *ctx, arg_ABS_rr *a) { - prt("abs\t"); - if (a->rs == a->rd) { - prt("r%d", a->rd); + if (a->rs != a->rd) { + prt("abs\tr%d, r%d", a->rs, a->rd); } else { - prt("r%d, r%d", a->rs, a->rd); + prt("abs\tr%d", a->rs); } return true; } @@ -733,11 +736,11 @@ static bool trans_DIVU_mr(DisasContext *ctx, arg_DIVU_mr *a) /* shll #imm:5, rs, rd */ static bool trans_SHLL_irr(DisasContext *ctx, arg_SHLL_irr *a) { - prt("shll\t#%d, ", a->imm); if (a->rs2 != a->rd) { - prt("r%d, ", a->rs2); + prt("shll\t#%d, r%d, r%d", a->imm, a->rs2, a->rd); + } else { + prt("shll\t#%d, r%d", a->imm, a->rd); } - prt("r%d", a->rd); return true; } @@ -752,11 +755,11 @@ static bool trans_SHLL_rr(DisasContext *ctx, arg_SHLL_rr *a) /* shar #imm:5, rs, rd */ static bool trans_SHAR_irr(DisasContext *ctx, arg_SHAR_irr *a) { - prt("shar\t#%d,", a->imm); if (a->rs2 != a->rd) { - prt("r%d, ", a->rs2); + prt("shar\t#%d, r%d, r%d", a->imm, a->rs2, a->rd); + } else { + prt("shar\t#%d, r%d", a->imm, a->rd); } - prt("r%d", a->rd); return true; } @@ -771,11 +774,11 @@ static bool trans_SHAR_rr(DisasContext *ctx, arg_SHAR_rr *a) /* shlr #imm:5, rs, rd */ static bool trans_SHLR_irr(DisasContext *ctx, arg_SHLR_irr *a) { - prt("shlr\t#%d, ", a->imm); if (a->rs2 != a->rd) { - prt("r%d, ", a->rs2); + prt("shlr\t#%d, r%d, r%d", a->imm, a->rs2, a->rd); + } else { + prt("shlr\t#%d, r%d", a->imm, a->rd); } - prt("r%d", a->rd); return true; } From patchwork Fri Jun 7 15:37:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 166172 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp874605ili; Fri, 7 Jun 2019 09:51:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLxJOZRNtiExOgsxelTA2rsWZO6xh4F7hk3ykzpfs4LkfzMse7XvHBDqePY0nCK1rWLBRj X-Received: by 2002:ac8:3345:: with SMTP id u5mr48028194qta.219.1559926267723; Fri, 07 Jun 2019 09:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559926267; cv=none; d=google.com; s=arc-20160816; b=ES+iGa2J3bvDec/zLm//Q2P+j6N4/mYpwbqwvidKed2sCYSlmSSL/buwjHZPCFZ55H qt1s2WF02Sd8o87htUbnnuKQs73L9g1y1+E9H/gChQdN+GqD7hRdrhXmpUdUkJEDwOEQ 5LcaZ8ue2z/NqUDfQHrgtTAypS3iHrgmG2e2dVx2Kttn6BoPCk6hXU0Ozcbts1U+fm96 7hkDxKqd7PXWIzJmELYVTpxX+z91tKTW2GGhW4dP/JryD6ZClBd1sxRkrwiEWFDmbB3U J+qZjmMGOwgCFfYHs3ZDQ7Z6p1caIdCsBi9ZleFQq+dTYIU2upy/g1RejXQZv3RKzvbe qjzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=iUBrg0inbEBl3V6cTQTXpEl9w4QTbbB/0f2WLn8DJxI=; b=BMZTNhOe9fRVj552kQ7f+29KiaLIeOe0j9OozUoM8pic/pu9/ZxAU6l/DginoLUCKs DT1oEt1qtuDHilZQNtWROIRdmu/B4U4sbU507Qsc7BfSqqNcbLNfStHvD7v47VivUgtB i32ZgOyP7//3TU3dMOKxaHULUNcp4049CaYsqsfzSP52oaHoj+1eKo3Ih14pyl7EHehx Zk+tEJQRuGhoNRqYSpQRPHGiK8+YuQWIsczkhlWpTg3H1+ojdhgbNpc5RJKi/kGYSxIF ny69DvbQHweaGbU6o+cCjGfy+dWOzb0LUA7qsVTlR0wuCbrjz4xhm4R9wsjkPOJ5gHJp OYQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i66si1531498qtb.274.2019.06.07.09.51.07 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 09:51:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:49552 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZI55-00069D-7e for patch@linaro.org; Fri, 07 Jun 2019 12:51:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53389) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZGzq-0003Yj-IP for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:41:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZGxv-0003Az-QA for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:39:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31227) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hZGxt-00035t-TV for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:39:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3233B3B72D; Fri, 7 Jun 2019 15:39:31 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF6D080882; Fri, 7 Jun 2019 15:39:25 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Yoshinori Sato , qemu-devel@nongnu.org, Igor Mammedov , Richard Henderson Date: Fri, 7 Jun 2019 17:37:20 +0200 Message-Id: <20190607153725.18055-25-philmd@redhat.com> In-Reply-To: <20190607153725.18055-1-philmd@redhat.com> References: <20190607153725.18055-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 07 Jun 2019 15:39:31 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v18 24/29] target/rx: Collect all bytes during disassembly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Collected, to be used in the next patch. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Yoshinori Sato Signed-off-by: Yoshinori Sato Message-Id: <20190607091116.49044-23-ysato@users.sourceforge.jp> Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/rx/disas.c | 62 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 20 deletions(-) -- 2.20.1 diff --git a/target/rx/disas.c b/target/rx/disas.c index ebc1a44249..5a32a87534 100644 --- a/target/rx/disas.c +++ b/target/rx/disas.c @@ -25,43 +25,59 @@ typedef struct DisasContext { disassemble_info *dis; uint32_t addr; uint32_t pc; + uint8_t len; + uint8_t bytes[8]; } DisasContext; static uint32_t decode_load_bytes(DisasContext *ctx, uint32_t insn, - int i, int n) + int i, int n) { - bfd_byte buf; + uint32_t addr = ctx->addr; + + g_assert(ctx->len == i); + g_assert(n <= ARRAY_SIZE(ctx->bytes)); + while (++i <= n) { - ctx->dis->read_memory_func(ctx->addr++, &buf, 1, ctx->dis); - insn |= buf << (32 - i * 8); + ctx->dis->read_memory_func(addr++, &ctx->bytes[i - 1], 1, ctx->dis); + insn |= ctx->bytes[i - 1] << (32 - i * 8); } + ctx->addr = addr; + ctx->len = n; + return insn; } static int32_t li(DisasContext *ctx, int sz) { - int32_t addr; - bfd_byte buf[4]; - addr = ctx->addr; + uint32_t addr = ctx->addr; + uintptr_t len = ctx->len; switch (sz) { case 1: + g_assert(len + 1 <= ARRAY_SIZE(ctx->bytes)); ctx->addr += 1; - ctx->dis->read_memory_func(addr, buf, 1, ctx->dis); - return (int8_t)buf[0]; + ctx->len += 1; + ctx->dis->read_memory_func(addr, ctx->bytes + len, 1, ctx->dis); + return (int8_t)ctx->bytes[len]; case 2: + g_assert(len + 2 <= ARRAY_SIZE(ctx->bytes)); ctx->addr += 2; - ctx->dis->read_memory_func(addr, buf, 2, ctx->dis); - return ldsw_le_p(buf); + ctx->len += 2; + ctx->dis->read_memory_func(addr, ctx->bytes + len, 2, ctx->dis); + return ldsw_le_p(ctx->bytes + len); case 3: + g_assert(len + 3 <= ARRAY_SIZE(ctx->bytes)); ctx->addr += 3; - ctx->dis->read_memory_func(addr, buf, 3, ctx->dis); - return (int8_t)buf[2] << 16 | lduw_le_p(buf); + ctx->len += 3; + ctx->dis->read_memory_func(addr, ctx->bytes + len, 3, ctx->dis); + return (int8_t)ctx->bytes[len + 2] << 16 | lduw_le_p(ctx->bytes + len); case 0: + g_assert(len + 4 <= ARRAY_SIZE(ctx->bytes)); ctx->addr += 4; - ctx->dis->read_memory_func(addr, buf, 4, ctx->dis); - return ldl_le_p(buf); + ctx->len += 4; + ctx->dis->read_memory_func(addr, ctx->bytes + len, 4, ctx->dis); + return ldl_le_p(ctx->bytes + len); default: g_assert_not_reached(); } @@ -110,7 +126,7 @@ static const char psw[] = { static void rx_index_addr(DisasContext *ctx, char out[8], int ld, int mi) { uint32_t addr = ctx->addr; - uint8_t buf[2]; + uintptr_t len = ctx->len; uint16_t dsp; switch (ld) { @@ -119,14 +135,18 @@ static void rx_index_addr(DisasContext *ctx, char out[8], int ld, int mi) out[0] = '\0'; return; case 1: + g_assert(len + 1 <= ARRAY_SIZE(ctx->bytes)); ctx->addr += 1; - ctx->dis->read_memory_func(addr, buf, 1, ctx->dis); - dsp = buf[0]; + ctx->len += 1; + ctx->dis->read_memory_func(addr, ctx->bytes + len, 1, ctx->dis); + dsp = ctx->bytes[len]; break; case 2: + g_assert(len + 2 <= ARRAY_SIZE(ctx->bytes)); ctx->addr += 2; - ctx->dis->read_memory_func(addr, buf, 2, ctx->dis); - dsp = lduw_le_p(buf); + ctx->len += 2; + ctx->dis->read_memory_func(addr, ctx->bytes + len, 2, ctx->dis); + dsp = lduw_le_p(ctx->bytes + len); break; default: g_assert_not_reached(); @@ -1392,8 +1412,10 @@ int print_insn_rx(bfd_vma addr, disassemble_info *dis) DisasContext ctx; uint32_t insn; int i; + ctx.dis = dis; ctx.pc = ctx.addr = addr; + ctx.len = 0; insn = decode_load(&ctx); if (!decode(&ctx, insn)) { From patchwork Fri Jun 7 15:37:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 166171 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp857116ili; Fri, 7 Jun 2019 09:35:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxK6Ji37wIvps8KPAPV5iwOY1aLiqyRYOViPGJUYQj7sqGDESFllbmnTk2ABIqtfWha9WDr X-Received: by 2002:ac8:2cdd:: with SMTP id 29mr46889142qtx.153.1559925324257; Fri, 07 Jun 2019 09:35:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559925324; cv=none; d=google.com; s=arc-20160816; b=ISXSyXW4SirebZzcD8B3CFsb8jpvclAJKPPJhmDLWx2gBSswZUCAPO470U/kDa9ZjY y9tC387fpZCjOTDu2tPgZBS423v81N+XfiQ41JDP+rTrRB0B+jFsPToDCsPWVrzyo0uT gjcLhyByWlB8EuSGBoFqNbOHbqr9Vk1lZPNd25zkQUqjzTzptFjeUH1g85q+AIvr1h/W koPQJqwWsebnMFYIAzlJeZ5Op+uQffN87Eja7mSQ9mRpz6ZRWWsgtnSRYdFLpXUJomMW sFScmR6xsZtopcV2O26mu6jjqlJwWKRHPxkI/692Ko64hpvxhT5devgq0QJZNfTSuYUG ARnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=fjiHS9xytTkZ9fd06fQEBg4Kt9fDBI24+AHRH/hfj1M=; b=DmRKqqWj2JPNR9rjkERs/75tYbejVWw1ulu+8CoGvnwyI+C8xpHU600o3UM0KTjD0S m7C2Z5cNhEmHf1FluCad/jG5ES/MWAE/XSmXyQiw6pj3agxG8HQMvc6+mp0oFPNHT5om LZjHBXFXQVaRr3txHjhcHGIrPasDgahQYpxACuDwvLIWRK/Y46rk2dvgpBupjXx6P+RN iLI0NvfaZG9PoAatQyoBlPT+YQDmt0bxy6h4mDUrHFHdXkAmKyp8B8qftGca5YvJI4Sa KYdC9s5/fuBCjmEu5H1US/GnKTVBIXd8b7IxrU3lhwHPWRNzICUkQBt4jO/JWaFryyRY 68gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q30si585280qvc.39.2019.06.07.09.35.24 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Jun 2019 09:35:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:49460 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZHpr-0002tv-Qz for patch@linaro.org; Fri, 07 Jun 2019 12:35:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53309) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZGzf-0003Tv-QZ for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:41:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZGy6-0003SP-BD for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:39:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54456) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hZGy6-0003Bm-3c for qemu-devel@nongnu.org; Fri, 07 Jun 2019 11:39:50 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 395EB81122; Fri, 7 Jun 2019 15:39:35 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AF0426266B; Fri, 7 Jun 2019 15:39:31 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Yoshinori Sato , qemu-devel@nongnu.org, Igor Mammedov , Richard Henderson Date: Fri, 7 Jun 2019 17:37:21 +0200 Message-Id: <20190607153725.18055-26-philmd@redhat.com> In-Reply-To: <20190607153725.18055-1-philmd@redhat.com> References: <20190607153725.18055-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 07 Jun 2019 15:39:35 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v18 25/29] target/rx: Dump bytes for each insn during disassembly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson There are so many different forms of each RX instruction that it will be very useful to be able to look at the bytes to see on which path a bug may lie. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Yoshinori Sato Signed-off-by: Yoshinori Sato Message-Id: <20190607091116.49044-24-ysato@users.sourceforge.jp> Tested-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/rx/disas.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/target/rx/disas.c b/target/rx/disas.c index 5a32a87534..d73b53db44 100644 --- a/target/rx/disas.c +++ b/target/rx/disas.c @@ -102,7 +102,21 @@ static int bdsp_s(DisasContext *ctx, int d) /* Include the auto-generated decoder. */ #include "decode.inc.c" -#define prt(...) (ctx->dis->fprintf_func)((ctx->dis->stream), __VA_ARGS__) +static void dump_bytes(DisasContext *ctx) +{ + int i, len = ctx->len; + + for (i = 0; i < len; ++i) { + ctx->dis->fprintf_func(ctx->dis->stream, "%02x ", ctx->bytes[i]); + } + ctx->dis->fprintf_func(ctx->dis->stream, "%*c", (8 - i) * 3, '\t'); +} + +#define prt(...) \ + do { \ + dump_bytes(ctx); \ + ctx->dis->fprintf_func(ctx->dis->stream, __VA_ARGS__); \ + } while (0) #define RX_MEMORY_BYTE 0 #define RX_MEMORY_WORD 1