From patchwork Fri Sep 27 06:22:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 174586 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3100378ill; Thu, 26 Sep 2019 23:59:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXzKZnklbKCNvJKVgXHboD29ofq5tRQCeBImwTrv9YLCEX1DiNRzE6a1PSCEbbMWHUcBFC X-Received: by 2002:a37:2e01:: with SMTP id u1mr3060535qkh.455.1569567569210; Thu, 26 Sep 2019 23:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569567569; cv=none; d=google.com; s=arc-20160816; b=xlJ2B9ytnp9wdTKpO+GN6gomZxFOnKOxJKyhXZacBhqbmsSt3MngnVLzszYLXDCsvJ h18n7ualkpnfC5uiM8MrnLT1wzrBeQJGh5rPK02TkK4Bd2KqJNFVWlkG1Ix9UIJS6KFo lhfFrIcvuqIQyaqFppVQBRVrUfqqG6RihR57joabSaIRISekrJg/XTx8xZwot2Xjh291 XAInV0G40eiYdBUmRpuSwwUe3eA6cBnT563K3WUYCo36AAs+mgr9gYj1qaNNmNK6070c 9fztjgoh1uybYw+bxbGIofdBa0wA2LeaTvo9DsCmmRt5thoZFbp1JBJ3v+vM6/V8wFiF BRjA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=Sgdo76gvbPkRQQZ+JZOWnZpm0cyBZ+UiKG5pJTMw9+g=; b=uYNrVdqoj8kxkSbgO+PM1L1MoPDP3YlBE3eqWQtFlJWx72CGadMr9AtXVydQOILhyh Z5a8dwMBP18Q3wiDKWyeI0XviaMJkYJlJKuWIGDhYY69D9TU5Wc130wgpP9l44naKO30 QFQb+JvDcK9n2amSxmpPpLqptLSDAQZTMWXjpv6VWY8WKwyWb3sJ2FlJT0+YAzp9C37j qek/FENpDWj9qz1ESsoI7kQqJ3auWhESabsk2axzPTUO8CvvZl5uFZ0TKjfdlvSg4zme 6rOMmaNir509TdcGEKmmwcA+rjpvPYo3jfjmkj6pAf2MGiMUv923wpsA3z2Dzd+LgABS 02Cw== 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p57si3878296qtk.10.2019.09.26.23.59.29 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Sep 2019 23:59:29 -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" Received: from localhost ([::1]:47182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDkDw-00015T-NU for patch@linaro.org; Fri, 27 Sep 2019 02:59:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53758) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDjex-0007Id-6Z for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDjes-0004AG-Ei for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:18 -0400 Received: from mail02.asahi-net.or.jp ([202.224.55.14]:59370) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iDjes-0003yk-2z for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:14 -0400 Received: from h61-195-96-97.vps.ablenet.jp (h61-195-96-97.ablenetvps.ne.jp [61.195.96.97]) (Authenticated sender: PQ4Y-STU) by mail02.asahi-net.or.jp (Postfix) with ESMTPA id 79B566CCF6; Fri, 27 Sep 2019 15:23:11 +0900 (JST) Received: from yo-satoh-debian.localdomain (ZM005235.ppp.dion.ne.jp [222.8.5.235]) by h61-195-96-97.vps.ablenet.jp (Postfix) with ESMTPSA id 21342240086; Fri, 27 Sep 2019 15:23:11 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Subject: [PATCH v25 08/22] target/rx: Disassemble rx_index_addr into a string Date: Fri, 27 Sep 2019 15:22:48 +0900 Message-Id: <20190927062302.110144-9-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927062302.110144-1-ysato@users.sourceforge.jp> References: <20190927062302.110144-1-ysato@users.sourceforge.jp> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 202.224.55.14 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: peter.maydell@linaro.org, imammedo@redhat.com, Richard Henderson , Yoshinori Sato , philmd@redhat.com 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 Sep 27 06:22:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 174580 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3081821ill; Thu, 26 Sep 2019 23:35:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzz12ojL95ny6VweCfzte8rB931uLY8koItUcNZ6V+6yYV7qQOWlAzHKTzq40fEMPIxI/aQ X-Received: by 2002:a37:708:: with SMTP id 8mr2975476qkh.273.1569566119879; Thu, 26 Sep 2019 23:35:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569566119; cv=none; d=google.com; s=arc-20160816; b=vePzi8AxoNvcO9oOXJRUO9ywxotmYtmbTgodvAVVbEdiT9iHG20+V6NjwfNOGfoGt0 V2ivz4g0WKG0lrEQAsn9vFmxdLAsJrTjRaD2ulGHAi1Y93wjZPpHd21oGDlY0LN+tLQ6 n8a6MH6X0sfMo4NxpKyMivCvedEi50caIyxHyANzQEGja7XRTU0jbhTFBUfhTOke2Fj+ t0nFOPBEN/kVYVUhQv9Vt+blIu54KghtjsRh8KsN5DJI6nh9fkRu1BLYeeMRThfSTZT9 E/urz78yLqOsbK6GEt1JiCP9WMjHTgEbgKk8NdNygxLHw5e9cSMPJYy0UaWGFD+5TN8i h6GA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=vw0gLml6GKKdwWn024UJOrJouescxVwiiTcyvJzkU+Y=; b=sTobtm1MDTES2urcAA7sLcUpIZd+JV0KCygblmgbGuQSKk9+BYayyd7fdTINab7Rp/ OWOWo20KXF0DjUJH4wO2JBG004/yANGEEyt44Lfrq4LmbWcnfUwoJfxjsdOx3tXfIYnc lMoP4SJVZ3HSCzGiEr9bHT8xA9XVPo04CpJQenbcai8F8igojvHJ+f5Q/+2OpWyyTOhq 17VveIf/Z26U4XnSC9jktvbp2coorD72uapNh7zLBb/kz1f0zTgIEw5xlQWLF1Uq6lvw GDJa7V/MKnyXXKt7JUs1epzhoK7691DR+7vS/zkumhuRgngFLFnPc/3G9cCo2OWdFXYV 2o9g== 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x195si1790924qkb.162.2019.09.26.23.35.19 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Sep 2019 23:35:19 -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" Received: from localhost ([::1]:46950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDjqY-0000PZ-Id for patch@linaro.org; Fri, 27 Sep 2019 02:35:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53754) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDjew-0007IH-W4 for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDjer-00047P-UY for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:18 -0400 Received: from mail02.asahi-net.or.jp ([202.224.55.14]:59375) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iDjer-00041c-IW for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:13 -0400 Received: from h61-195-96-97.vps.ablenet.jp (h61-195-96-97.ablenetvps.ne.jp [61.195.96.97]) (Authenticated sender: PQ4Y-STU) by mail02.asahi-net.or.jp (Postfix) with ESMTPA id DBEC66CD09; Fri, 27 Sep 2019 15:23:11 +0900 (JST) Received: from yo-satoh-debian.localdomain (ZM005235.ppp.dion.ne.jp [222.8.5.235]) by h61-195-96-97.vps.ablenet.jp (Postfix) with ESMTPSA id 77FD3240085; Fri, 27 Sep 2019 15:23:11 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Subject: [PATCH v25 09/22] target/rx: Replace operand with prt_ldmi in disassembler Date: Fri, 27 Sep 2019 15:22:49 +0900 Message-Id: <20190927062302.110144-10-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927062302.110144-1-ysato@users.sourceforge.jp> References: <20190927062302.110144-1-ysato@users.sourceforge.jp> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 202.224.55.14 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: peter.maydell@linaro.org, imammedo@redhat.com, Richard Henderson , Yoshinori Sato , philmd@redhat.com 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 Sep 27 06:22:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 174581 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3085311ill; Thu, 26 Sep 2019 23:39:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqyaWXXjdde8Ev/7GAyeMupW42JZIVidPA9heS3Yuysor6S6im6anuWRQg3gWTdejLcdZPRu X-Received: by 2002:a37:be87:: with SMTP id o129mr3087227qkf.254.1569566380779; Thu, 26 Sep 2019 23:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569566380; cv=none; d=google.com; s=arc-20160816; b=mTN0YxRawV8I7WTU/rX7EnviMbyT+OVTlloj7znSfmlp3yKstsGfXEsVHK/ELEZLLY NKz0FouthSRbPe7oxEFM712vjCmqOVzefagZsQgA68TEKwW7BdNEM3CNWJe6ENEcY6tI 2yI0wg+wI8dug+A2KiAqsIACN0DazTrYPff2/RoiASJhkWctC3ULQ1QD3lbRa4dftSw9 Ru/rd7aoIbSZpJqtCg4x6JyqwuuFRMJH090reZGv/GukC3FpVnq7YFacyWtE7TSjU8hr TytZ1UksC5aRo+geXoz3NZsGIsqj4A2I827IC+RNK5waMju2YqPUYYqUz7Lm1gn9Xmvf u48Q== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=vBgmqVV1HHXMsA9aXkS1dhyBW4HB0voCVVWuH7KTmpU=; b=a6//2xzZtrMIvP1GlKCw5SYShSUtnDstqtC2fgSGdeCFrmNWeXYl/GmX9gmewBqDQb S8eXS6EB6ic0JvXN2zPSq2OMof9TEcgP+m2UF0JDunOiDWd3q2rQY8057x4mBAYIxZ3P WVTeZ2XoVcN9ATgVFhHP+roaDvyl9c4+PA93/pHPYW+Gp72mEmY9G3bKpkfL2VNtGoVr j+8lzQR1LMqE477EMYhD9j8plaWY318NRuT40y2yw2q3aDEH+sqGab7roE6ebuS9ClEH WzyAbbIWMVmEwsUpcbvkJ05UPkx/9mbMn7g3phbpB+N/AzXfmHdpyXpiFmxee8xqIRly PzbQ== 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z187si1779295qkd.135.2019.09.26.23.39.40 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Sep 2019 23:39: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" Received: from localhost ([::1]:46978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDjul-0004Wk-Ql for patch@linaro.org; Fri, 27 Sep 2019 02:39:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53638) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDjes-0007B8-P4 for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDjeq-00045A-WB for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:14 -0400 Received: from mail02.asahi-net.or.jp ([202.224.55.14]:59379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iDjeq-00042X-NE for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:12 -0400 Received: from h61-195-96-97.vps.ablenet.jp (h61-195-96-97.ablenetvps.ne.jp [61.195.96.97]) (Authenticated sender: PQ4Y-STU) by mail02.asahi-net.or.jp (Postfix) with ESMTPA id 284146CD08; Fri, 27 Sep 2019 15:23:12 +0900 (JST) Received: from yo-satoh-debian.localdomain (ZM005235.ppp.dion.ne.jp [222.8.5.235]) by h61-195-96-97.vps.ablenet.jp (Postfix) with ESMTPSA id D3D6F240086; Fri, 27 Sep 2019 15:23:11 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Subject: [PATCH v25 10/22] target/rx: Use prt_ldmi for XCHG_mr disassembly Date: Fri, 27 Sep 2019 15:22:50 +0900 Message-Id: <20190927062302.110144-11-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927062302.110144-1-ysato@users.sourceforge.jp> References: <20190927062302.110144-1-ysato@users.sourceforge.jp> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 202.224.55.14 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: peter.maydell@linaro.org, imammedo@redhat.com, Richard Henderson , Yoshinori Sato , philmd@redhat.com 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 Sep 27 06:22:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 174585 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3098193ill; Thu, 26 Sep 2019 23:56:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVoIdi3xTpR8ndRH3yf3uulHgFH5HX/I8KMf1oyQSpOGdeMB6XbcrxVWeERLZ/SN8btXU/ X-Received: by 2002:ac8:44d3:: with SMTP id b19mr8241228qto.361.1569567398064; Thu, 26 Sep 2019 23:56:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569567398; cv=none; d=google.com; s=arc-20160816; b=SZo0LdX9VKGFkaQv9GE3cBh5g1HCi0bdncDSRwMilUbDJQgraOfj6Tl2aEDvxcB3Xv 1XgOEAgZgDLGBMHOEij9cnBen+odMKudnD9rcvkn0MJAj/+28dHrz0xsL4srnAEtnJS5 o2OjE2Ncg7hXub2hGWGEN/6x4TWG9Nii6oPvU9E+W3kvvALGQSyA60fACb/uRP3Ion7M oa0x0KWf3wdLBLp+sgLMTtltQSykNeMHhHmokMXZRvPU1ek36GvgvwlACMWVe7jQaKGb hcezeOp+CK3NZq42d3ieWgd3aSLZ40kW8fNaucEf1m6zRggBVFtXkiPJvwCQh6dOS/8v 87DA== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=/s500mB5cnXJIsX9IKljur+jp56CjbsyHaOWGoXs1zo=; b=aaRiK6PCgtYhwWLeUQgLttlIF+yAyC/dgc8OfhCoMrUGmPs0opeK59JiYTKHklidvT InT+0CR3Bu7yyP+4wJjpZ/5iVw37lwiU0McPxwxMXtveWRfAOjH/Thjzu/k0rHEWWFbc O6nMwsy2ecV0m1y8kUvN/7Px53UK7XvDvmBZR72rMdPREb1D85SedRncMsswWSFxNhK6 pY5BOrGVkM83f1JENbmV9ySIg64YWa15+Cj91E8wzXpbYybcDQPYyJYwFYbVMWMSlqKX sVjEbUgsVRfHbY7ntnh7OfsF0cq7P1oFhb+f/0SeUWXJ/yO75tpxVpWZwnwV8q+5mkAE 8SCQ== 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p29si3822408qve.189.2019.09.26.23.56.37 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Sep 2019 23:56:38 -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" Received: from localhost ([::1]:47156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDkBB-00076U-EK for patch@linaro.org; Fri, 27 Sep 2019 02:56:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53720) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDjew-0007H3-96 for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDjer-00046t-Qw for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:16 -0400 Received: from mail02.asahi-net.or.jp ([202.224.55.14]:59386) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iDjer-000460-Gj for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:13 -0400 Received: from h61-195-96-97.vps.ablenet.jp (h61-195-96-97.ablenetvps.ne.jp [61.195.96.97]) (Authenticated sender: PQ4Y-STU) by mail02.asahi-net.or.jp (Postfix) with ESMTPA id 7A4996CD14; Fri, 27 Sep 2019 15:23:12 +0900 (JST) Received: from yo-satoh-debian.localdomain (ZM005235.ppp.dion.ne.jp [222.8.5.235]) by h61-195-96-97.vps.ablenet.jp (Postfix) with ESMTPSA id 29E18240085; Fri, 27 Sep 2019 15:23:12 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Subject: [PATCH v25 11/22] target/rx: Emit all disassembly in one prt() Date: Fri, 27 Sep 2019 15:22:51 +0900 Message-Id: <20190927062302.110144-12-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927062302.110144-1-ysato@users.sourceforge.jp> References: <20190927062302.110144-1-ysato@users.sourceforge.jp> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 202.224.55.14 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: peter.maydell@linaro.org, imammedo@redhat.com, Richard Henderson , Yoshinori Sato , philmd@redhat.com 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 Sep 27 06:22:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 174583 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3092857ill; Thu, 26 Sep 2019 23:49:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqyeA3KBX11smcNByKJmzxZhXhxHm2WK0Y+VyyYnlWmswTDcizi7R96oU0JfjFt6sFvl+F+3 X-Received: by 2002:ac8:2a75:: with SMTP id l50mr8587944qtl.137.1569566986705; Thu, 26 Sep 2019 23:49:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569566986; cv=none; d=google.com; s=arc-20160816; b=u2gBzygHYWSx/DxRywWWGeqV84ud0kn8kBocLOkRcaYzVfbC5/8s4XqiHIqQmiavEg qzR/2+80yyQkRYE/5kmVd6Rlxl1FWutGAryKJjxLG0PtM2j5YPbP4bkI8FQTfu6Ya/Rx ywBZxef0S+YsNAsSPlus9a3UzA3x6qjD3lccjgBblHRz2x7Fxe73fCoC2oM3DFSrAWjA DubXxgJ+VwLikLpmG6yNDvEHnIZ0lLS5i7ANBIe3f/WzhK3ewXMc8npQVrgJlv4Q1Fwk HELXI8XpmYYNEsfv8sLBbKKHK/nD/7WtFLRuD/ZPm0D67WQ7UUT/foHeHPKuDrWEdN64 AFUw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=iUBrg0inbEBl3V6cTQTXpEl9w4QTbbB/0f2WLn8DJxI=; b=Z3GOUIZszjK4bE03jBwNWBuTkICAGfq31NBOSj2C2tTkOZybFVwaLC/6imWOe3TUb5 XgpM7Qp9qcvUTmMA5aAuYsrplR2Q2JATDV/Mamr07NvnPYzFUi8+WKNjTe66peNGaCEf 6NaAONfl5NIR2OSdJwMrQKxJxT2bsuwyDthRpqooAFF5Vm6epAuZ8438Y6g/eI7fjHGf pDZBc9I4qsFaTek9dZ+y7yzGSLUk3j+HB2XpoKlV2mLxCk36yMTJfbrgfh+fmvJrO9ZI nPMqS/4EXtAbAbWnh1DOV0bEvs6XBPOgq7ARJ1cGanlaJUpII3rcVPZIfqaL6IZRBZUO DrWA== 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d7si3794691qtr.268.2019.09.26.23.49.46 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Sep 2019 23:49:46 -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" Received: from localhost ([::1]:47064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDk4X-0005S9-LU for patch@linaro.org; Fri, 27 Sep 2019 02:49:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53759) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDjex-0007Ih-7Q for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDjet-0004EX-TT for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:18 -0400 Received: from mail03.asahi-net.or.jp ([202.224.55.15]:59670) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iDjet-00045l-Dc for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:15 -0400 Received: from h61-195-96-97.vps.ablenet.jp (h61-195-96-97.ablenetvps.ne.jp [61.195.96.97]) (Authenticated sender: PQ4Y-STU) by mail03.asahi-net.or.jp (Postfix) with ESMTPA id CF44469A95; Fri, 27 Sep 2019 15:23:12 +0900 (JST) Received: from yo-satoh-debian.localdomain (ZM005235.ppp.dion.ne.jp [222.8.5.235]) by h61-195-96-97.vps.ablenet.jp (Postfix) with ESMTPSA id 7FC58240086; Fri, 27 Sep 2019 15:23:12 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Subject: [PATCH v25 12/22] target/rx: Collect all bytes during disassembly Date: Fri, 27 Sep 2019 15:22:52 +0900 Message-Id: <20190927062302.110144-13-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927062302.110144-1-ysato@users.sourceforge.jp> References: <20190927062302.110144-1-ysato@users.sourceforge.jp> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 202.224.55.15 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: peter.maydell@linaro.org, imammedo@redhat.com, Richard Henderson , Yoshinori Sato , philmd@redhat.com 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 Sep 27 06:22:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 174582 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3088091ill; Thu, 26 Sep 2019 23:43:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxqqGOsYD6BqgSq40uxZOcoOO2rGXBUn4gXwOiopvYXVD3thKDGXTGWjuoivgLxims2rUWE X-Received: by 2002:a0c:eb10:: with SMTP id j16mr1243968qvp.207.1569566607521; Thu, 26 Sep 2019 23:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569566607; cv=none; d=google.com; s=arc-20160816; b=KvJ+nIW4TNKOCcgHygVONLQ4Kd8kUM260vnr14AmkjUq4MvoewNKdrSO+AxLmN3CqK 2pFtMiyQVqvXmAGnk77PFA+wRuD0DyUelWefv7iBKFczXeKd3WFeMTwKfE1OzjatqmRo QSmuulakf/Tq57vvM9YHaM+u+dsjMQEgSERVeo1UZ6LhEoN2stEoFKxKJ8GWR1Oos8RG 9XlwayBQZxRVl5RdfLI8oJgkvzImv0oCwo5ZU5MV+cVJWXbjM3+baV3Full0Yk6F82Tt l1lMVWsnjzIRLRgfMapsatkS8m7ih7s/zOOKG3FQN/FHQZNbM97FMerCdvokP55h6WEr TzeQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=fjiHS9xytTkZ9fd06fQEBg4Kt9fDBI24+AHRH/hfj1M=; b=hqSW1uZKx26gNVkb114hwEi6fa81lRzrM1hgng00qV0EEf2DTzZPIHWxLDmsFpi1o3 zW2F4X9uGl06vbP9CHKROnCiX3uUJKSim/JSjjvR1jwUnLjOtEty3YT8yyDWD2X9LenE ZR3Rxl1gey8WFwTDDrWD9an1oprOZHuuHLjri7xCaP9zXccvbg4keVPQxAGhruqQph0w TdxbS8jerbJzYSxLTKRfuniUtvARxxOd+kUg3Hx4XWZ7XubX0dM8dgMp7usKr5uJe8rp DJvbFabxrSLWQPw3mv6zE/P49GHUycPAIaZkwsQrcSTiivMmWH7u34qAOmma8I8tcIpV Gwig== 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c22si298389qko.286.2019.09.26.23.43.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Sep 2019 23:43:27 -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" Received: from localhost ([::1]:47028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDjyQ-0000wb-GL for patch@linaro.org; Fri, 27 Sep 2019 02:43:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53672) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDjev-0007Dx-9V for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDjes-000483-0i for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:16 -0400 Received: from mail03.asahi-net.or.jp ([202.224.55.15]:59674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iDjer-00046D-Ms for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:13 -0400 Received: from h61-195-96-97.vps.ablenet.jp (h61-195-96-97.ablenetvps.ne.jp [61.195.96.97]) (Authenticated sender: PQ4Y-STU) by mail03.asahi-net.or.jp (Postfix) with ESMTPA id 1F26069A96; Fri, 27 Sep 2019 15:23:13 +0900 (JST) Received: from yo-satoh-debian.localdomain (ZM005235.ppp.dion.ne.jp [222.8.5.235]) by h61-195-96-97.vps.ablenet.jp (Postfix) with ESMTPSA id CC62D240085; Fri, 27 Sep 2019 15:23:12 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Subject: [PATCH v25 13/22] target/rx: Dump bytes for each insn during disassembly Date: Fri, 27 Sep 2019 15:22:53 +0900 Message-Id: <20190927062302.110144-14-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927062302.110144-1-ysato@users.sourceforge.jp> References: <20190927062302.110144-1-ysato@users.sourceforge.jp> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 202.224.55.15 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: peter.maydell@linaro.org, imammedo@redhat.com, Richard Henderson , Yoshinori Sato , philmd@redhat.com 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 From patchwork Fri Sep 27 06:22:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 174584 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp3095848ill; Thu, 26 Sep 2019 23:53:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbz2EhkU1P9PgnYhR6SAIEG+WW4b5ZalqYrZG/DgOXBqkIwu8UREQKOvBy1YbgO0UOAEZm X-Received: by 2002:ac8:7648:: with SMTP id i8mr8507554qtr.363.1569567217330; Thu, 26 Sep 2019 23:53:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569567217; cv=none; d=google.com; s=arc-20160816; b=uvC3etG//l4PvSw8iXhBZT28dVXv7f2oQtSSqGaFFL7THN+DV8Fltd6CKmYig/3CAO 2SBFuv9VulpYwrd32wyAQG2MJsdTNkFxvc15XxlrsN5nBt8skIvBb3YNI5VXe8E1qLrF OGM5ghWmoOFZQMnaynvvwTkrBqIFmaTLzvgkrxHmrNRvmhJKCrGbr/eu8R1P/VDwl//n 3OjWw+MDUHTVo4hUj/jiJoCRD5vm1SwXrLVdQYofp87CaDEzA9+Err1u75hCZacuTfgp cJf19ufDnEZcKR+HESEus6Tw8j1eMN14Pi2/UvalL2ld/CxtOFpniG7llG+/tm8knFx4 ycHw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=aJJM0vtTHXXmtrVHVv2W28wyOU8ZxR/iN7ySpCdtVXQ=; b=O2HjnEqdXLkJQr5UO2E6wmvRfHl9nCThqtqUN2YwDMAgKeoWWavkVUQSA5tlPBizHU H81Z4w8aOeEqeAk+iS0yzmJ+rZqchLCbfy6xUIeQnOLSJuQjNu3HHBFL2C2xGHa0HDuL Gdf9bktP9lK9h8+M9/QCKPl7mSAzJmc+w0gvRLldPmLaoGpeI/vj0CC6mPOXu6zl25PO TuE5SlYep33T8sSiIN8VbsG2MAEKDMMbyYMM5LOP+uxjUcciD3jhiedJ//B9B0v/jQLo wjTyS2iUKqayUH089FvEjvqmw6nNzhZN7IMCk73iWuOR0mj/E2YiUPA3HloUn1L/sMIH GJaQ== 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h20si4081337qvd.218.2019.09.26.23.53.37 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Sep 2019 23:53:37 -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" Received: from localhost ([::1]:47121 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDk8G-00035r-Ma for patch@linaro.org; Fri, 27 Sep 2019 02:53:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53735) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDjew-0007HW-GZ for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDjeu-0004HH-8F for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:18 -0400 Received: from mail02.asahi-net.or.jp ([202.224.55.14]:59398) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iDjet-0004CU-Q1 for qemu-devel@nongnu.org; Fri, 27 Sep 2019 02:23:16 -0400 Received: from h61-195-96-97.vps.ablenet.jp (h61-195-96-97.ablenetvps.ne.jp [61.195.96.97]) (Authenticated sender: PQ4Y-STU) by mail02.asahi-net.or.jp (Postfix) with ESMTPA id 282C86CC71; Fri, 27 Sep 2019 15:23:15 +0900 (JST) Received: from yo-satoh-debian.localdomain (ZM005235.ppp.dion.ne.jp [222.8.5.235]) by h61-195-96-97.vps.ablenet.jp (Postfix) with ESMTPSA id D202F240086; Fri, 27 Sep 2019 15:23:14 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Subject: [PATCH v25 18/22] hw/rx: Honor -accel qtest Date: Fri, 27 Sep 2019 15:22:58 +0900 Message-Id: <20190927062302.110144-19-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190927062302.110144-1-ysato@users.sourceforge.jp> References: <20190927062302.110144-1-ysato@users.sourceforge.jp> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 202.224.55.14 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: peter.maydell@linaro.org, imammedo@redhat.com, Richard Henderson , Yoshinori Sato , philmd@redhat.com 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 --- We could squash this with the previous patch --- 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 ac47f2a397..a0986fd15e 100644 --- a/hw/rx/rx62n.c +++ b/hw/rx/rx62n.c @@ -21,12 +21,14 @@ #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 "hw/qdev-properties.h" #include "sysemu/sysemu.h" +#include "sysemu/qtest.h" #include "cpu.h" /* @@ -191,8 +193,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); + } } /* Initialize CPU */