From patchwork Sun Jun 16 14:28:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 166957 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1790685ilk; Sun, 16 Jun 2019 07:48:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxG+pJitm2+JJWeRT1ZnqFsF47pd9lskKnK+TqCn8gMMUP2uE8QE/ZtFsx/YM2AI8HSq32E X-Received: by 2002:a37:4d14:: with SMTP id a20mr75957072qkb.87.1560696529222; Sun, 16 Jun 2019 07:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560696529; cv=none; d=google.com; s=arc-20160816; b=dqi4kEtsUhrK9j0OtO0crcRmQMvttQT9mqucp7GgCh06cuQVv1Ne6zVI/jpC+CGgaZ tCgt3At2vwqtvbTm+u0dblrnjxX/beZGhfxoNkkDum1jFNVlwRTjTorPgSGljS8cnYpJ 8ZNc0x3D0SYa6XtImAANO3HC/KQdGBQxZagNbrXIHdAMjMw4j5I6bCxnrjGLmTYGOudm 9zS3AYUcjLvNpEJd05yRZp/d5LniuH4XB2QS3yjA2+LOokh+a3at88zjWIccNnv8HP0P 7O/XaLsgMOVMRMSTv0bz9nXGAm9ZewhfDo2oaWEXYSFPp+0iuqvOszz21zBKZjMDZPcs ufiA== 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=B8oreZ1UUaVQy8wExGo1VlX14TnJ/QH2BkvL4RUHmxY=; b=aqSSUfQt3C9J3a50EdEdhip0ReYcibsM3u8TGyihkSnCK8e3jWgPKvSq1muHyh1Wkt F3Ki7+8lKV7QlQk6jExs0pzcaFMmQnI0FAQgdvE49HJjZYmiYE4AWYWdBwzS2idWxLE7 UTMF3ayo04HwOCIkLOjUFd0b+5i+nE96lxez62KKdAnELcVo+/L9Xy9ZXg2H6V2OUzRb maidmf7ZfeXs8aIj+MoupKgCmI6769rLI8N0dzklobJTUMWxHHfpfEuafZmK4DXq0JfT UWWFu+qwIaq7Ush8VxnDTd0jMA2uDMRZpoV+1q6AapULH/m+JHKuBKKTGyHVxRHFRCEu U5gg== 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 n19si6142994qtn.342.2019.06.16.07.48.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 16 Jun 2019 07:48:49 -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]:40442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcWSe-0003cH-R6 for patch@linaro.org; Sun, 16 Jun 2019 10:48:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36484) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcW9c-0005Nx-RG for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hcW9Y-0002RS-Ek for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:08 -0400 Received: from mail02.asahi-net.or.jp ([202.224.55.14]:55686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hcW9X-0002OI-Jf for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:04 -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 A002742AAE; Sun, 16 Jun 2019 23:28:47 +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 63D6B240087; Sun, 16 Jun 2019 23:28:47 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Date: Sun, 16 Jun 2019 23:28:19 +0900 Message-Id: <20190616142836.10614-8-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190616142836.10614-1-ysato@users.sourceforge.jp> References: <20190616142836.10614-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 Subject: [Qemu-devel] [PATCH v20 07/24] 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: peter.maydell@linaro.org, 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.11.0 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 Sun Jun 16 14:28:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 166960 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1802437ilk; Sun, 16 Jun 2019 08:03:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/yiwDp0Y2Ren0uiisuyGncooQKbkl42YnqgSrGzBtUabAGlOo2E+EfoY6qUOlGfE12wAD X-Received: by 2002:a0c:b90a:: with SMTP id u10mr17315220qvf.201.1560697435492; Sun, 16 Jun 2019 08:03:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560697435; cv=none; d=google.com; s=arc-20160816; b=tCqPqAIrmDu7ASfqy52Bi//AsFbw8hWW//nWPSkzWuEUBPqBOwbmFMmDutYuGk7qtk s2dyOAIqMIeINo79l5yOmLOAbi8Sm7hnKgmPRzRSEnxjA6Qn81eG/SFr12Icp2wp1BpI jyAh1HHpZVkknpmdlOK2Bj5ixHIh+zSH9IqFslWTkSUGDZYRCkiRtVcVhML5PL+qug/M TcT1kBPz6mcj6qrQbPL1R0CqLeGjb6byoFfVuKG4KG1hRL87aq+faP0ROAyPr9vCmyrJ SMaDxKmx/c1+uSZKaq2gNWyDGmhE8MPFQSbs18g0Uj2lY6AmBYVXGOA+qACRgmpnakO8 vHbw== 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=jTu2wzx8JM27GjAWjn0wK4UWJmXitjRNp8JpDRBD1cw=; b=xF9d8uvxWfwodc1Y1n9cayAFiNYt7qAYldSAZY9IXUHHZL5NLwG5GRHF97lyKm69mU sVHsoOP+nYWTTh/w/Jm/aMrzDXYDKLz0QE4olchc/0BM9+G6kyswrQOGM0NZ9HgFVkGo gOxkmlv504BnilxlSzi59jdqMHRu2gfb4qGNvySqGHMW+/METYpIt2GWxybnnxM4WlLP /kNSglcY/eH7a7oRmbwfZoIIMpgMLNFf3wULVsW0/NALO7BX6hlAtK366EMSI0M/3PjN QJBOPhwz4Ws+zyYykd9b8vGY06qrpNKeTio4VfPZsDEbecMjluxbu5HtOLNiGiSyefI7 uhYQ== 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 y10si5583730qvf.166.2019.06.16.08.03.55 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 16 Jun 2019 08:03:55 -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]:40538 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcWhH-00058F-46 for patch@linaro.org; Sun, 16 Jun 2019 11:03:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36480) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcW9c-0005Nr-Qj for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hcW9Y-0002RN-FZ for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:08 -0400 Received: from mail02.asahi-net.or.jp ([202.224.55.14]:55685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hcW9X-0002OH-Mh for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:04 -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 DCB9042ABE; Sun, 16 Jun 2019 23:28:47 +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 A5672240085; Sun, 16 Jun 2019 23:28:47 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Date: Sun, 16 Jun 2019 23:28:20 +0900 Message-Id: <20190616142836.10614-9-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190616142836.10614-1-ysato@users.sourceforge.jp> References: <20190616142836.10614-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 Subject: [Qemu-devel] [PATCH v20 08/24] 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: peter.maydell@linaro.org, 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.11.0 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 Sun Jun 16 14:28:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 166958 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1797708ilk; Sun, 16 Jun 2019 07:59:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7S7ewdVMAs4AyWDn/4ssMriwqaKRg4bsgy/ye5GhzWdGGO6FAXHIWtPuwPMnSzSQIxyun X-Received: by 2002:a37:9e93:: with SMTP id h141mr63814404qke.142.1560697142977; Sun, 16 Jun 2019 07:59:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560697142; cv=none; d=google.com; s=arc-20160816; b=YLJXUm5VUYldhL/kl/GDrYAJCFM3yEwxYxH4zw3sMPE2zNlAE3C0N6LwhSSUEmBELm 2tOikfAkIIjBg1omUq+SsLJ/8g+sGQyO/fYEpTRpGgjoh4rUe/gF8yNIp909x39h7inF vEVJR03n2tsVnzk+Gn8wqDbQ8t7at/BQB4Mall2H0iPvNBC6zYuQOdDsUD78c9X8O3b9 yLP+8QjMbVCzHEpuRy3mi7QXIBrZ7GqtdlsAqAZXjIqVi125KXZ9fPR0sYtOUvkbR9pT +7g6bANHjJovNkX9gINvbfENL5bIYdsXDYEFYIHDyB8fQaH2VF0hOhju4Acrwiz8la4d yRgg== 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=3ixQgoEQy/tNg2tvPIujS57kSkNC+oo3YmACrXAgGx8=; b=ET1VBSLUCVuDGtnUHJfWodkWS25ccl/btF9yScRpiaG0b4ezrYgB5hbhtvF2XbhPBl AGti6v0oJ5lWsJTwOosZHhmzhoIP8xOYwjMhc0KOiV3RJ1UjVMYVhCan0IcaJM1yD1bm t3iH67d/netgJhUhBY7ykZqBXpXoP9CcaXFvkoFoYJ3hjG7tq/7IlZsRaaHDaYr6OEYY blDNYgNmgV4hVGPNdMuuOv2Zu83BP6b4cyY7F2mTAfW3wNdv+Pbt7gyV6e9ySCODkyMK W8wztANLKfDPdX0zV2vB8PR1JsxMcjW18xVurLFiC6Uyf9qL+I3qfz8qpC2XFLhfvEDv raag== 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 k23si5201088qtm.270.2019.06.16.07.59.02 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 16 Jun 2019 07:59:02 -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]:40500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcWcY-000261-JS for patch@linaro.org; Sun, 16 Jun 2019 10:59:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36428) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcW9a-0005Ms-QM for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hcW9Y-0002Qz-9e for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:06 -0400 Received: from mail02.asahi-net.or.jp ([202.224.55.14]:55687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hcW9X-0002Oc-Os for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:04 -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 2A9A642B25; Sun, 16 Jun 2019 23:28:48 +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 E65DA240085; Sun, 16 Jun 2019 23:28:47 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Date: Sun, 16 Jun 2019 23:28:21 +0900 Message-Id: <20190616142836.10614-10-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190616142836.10614-1-ysato@users.sourceforge.jp> References: <20190616142836.10614-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 Subject: [Qemu-devel] [PATCH v20 09/24] 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: peter.maydell@linaro.org, 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.11.0 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 Sun Jun 16 14:28:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 166956 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1786834ilk; Sun, 16 Jun 2019 07:43:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdjdTfxHrqLrYu9CnBnRKsILfW+UqZjaOCtKT198SP5Zp3YTekEmlizWgpObsd+PTj0JyP X-Received: by 2002:a0c:b902:: with SMTP id u2mr17201210qvf.151.1560696201119; Sun, 16 Jun 2019 07:43:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560696201; cv=none; d=google.com; s=arc-20160816; b=uWYbsJG/TgIgJI6Nzu8haJCDXbox5Biq4IKaoNvePVrQpmKT+DHrq7warJfRYmO0Bv H6k77ugLCyTzhGXlNARCye3VUOOpRx9+21U0HORd/CNfxhrpL3L9AzaOgmoldk88e3ZO LbYsElAc9FyLWEcQL1ZGZUqs8uGFz7EdLTEHoBIsJ1h0CqOsO4sHeyKygBPKdLQzT6nF 8e66mopyRQsm4UrQHTb6xnUdzDmDse7g5W1eYpsUMl9hJObF2Z1zo/Eairpj/JyR6/kL czS1MVN2V43oWotNiu70sdZfXqQQ6ocK+wtemvagIliswX9GKZLUoUuqRi3yP1Byw45W RToQ== 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=wQ5nsogD+4OgIiy4BGtxkjRp2+tFBmAaVpuwIptouyo=; b=HI924Jk6kW3opwOz4qtYNuaq/dfAQlanyYJ7rEpwfWmJNkCy3Va5x7TJn9EoPc4Dql cJtGUPiEpXRBv/XDdFvqSzMEX/helDlXlaLK5JJmC5a59zsX2KMu9egdewldcG0DG0dl w/+2QKjkl3Ixlc5teRBCqy1B2jaNK4r2PV56G3emACKMpVAFI7KQrN/jE1i3wvT5OKme D/wr4Cfkv1Aeo1QMaERwBL3ygvY+Sqm3LKkUd+WLPPiEbniZbe3t5KBB6NSyeotx+iW5 ytunwYv3VnEVvNxI1TrlG+H0ls1jaf7l5LCQ9OQ+LqPldv4rjLQP1XAkOXRriY2a6ZQ9 BZzw== 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 y36si5671704qtk.15.2019.06.16.07.43.21 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 16 Jun 2019 07:43: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" Received: from localhost ([::1]:40410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcWNM-0000AV-O6 for patch@linaro.org; Sun, 16 Jun 2019 10:43:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36489) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcW9c-0005O5-R9 for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hcW9Y-0002RF-Do for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:08 -0400 Received: from mail02.asahi-net.or.jp ([202.224.55.14]:55688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hcW9X-0002Od-Pv for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:04 -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 7580942BCA; Sun, 16 Jun 2019 23:28:48 +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 3320D240085; Sun, 16 Jun 2019 23:28:48 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Date: Sun, 16 Jun 2019 23:28:22 +0900 Message-Id: <20190616142836.10614-11-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190616142836.10614-1-ysato@users.sourceforge.jp> References: <20190616142836.10614-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 Subject: [Qemu-devel] [PATCH v20 10/24] 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: peter.maydell@linaro.org, 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.11.0 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 Sun Jun 16 14:28:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 166959 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1798786ilk; Sun, 16 Jun 2019 08:00:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyESpHVIPJ5nMNuo+W17kH9jpH1hSRRhvgoxhq4HBnXb2CAslRDUnVMwD41box4IOXK6gpJ X-Received: by 2002:a37:490d:: with SMTP id w13mr69022102qka.179.1560697231375; Sun, 16 Jun 2019 08:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560697231; cv=none; d=google.com; s=arc-20160816; b=EhoGZvuOIOKmj8kSIC6zCQnPRAOjmCYY7g/gv1HXJpqkDIqYsAEP67Mi3wUzPf+PRz feojbYx2t241Su23hq6i2aK8EK9tNimBrRn1CJgQ7riNFrmCD168bVpnr6i9hhabC74T 46Vn4rU8xoIGJWZ6wYklvnWcjZkFcwkxKLiQEJ0m8Qj1VKFci0+DMSIlsbZzbfG/2Zks h764V8m0BkjDhd6F9AGxVUB+b7mKIgiC/8GiYBbGRDCopSUHrI6kfNAst5HdM58vLhlo LPhBRDa1k5oj0GoOWImROGdrx8XBtZbqKG89snmrYcfm5TfqjWcExrvLE4gM2UCOgO06 Mt8Q== 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=m48QTFxwZpa0wL4FBmo2IBPWtbo/UJRRDWyZpjLaKCw=; b=va58VgGGrD0E3m0/J06pt5xw0BMflE1zhCMQZWaImbFQtA4alkbNa9t8DErFPLfYYE M8RzGxfO2GPTDQaWngx3Tafk4Nu2fQ7flcTW5aqbxtu+bw2LOfgyhye3PXng+z3huUO4 X4pCsESpj/FmtmJSFtM1oeMxc50BWC8HwbVI4VGJKTZX2D7pzyKzAR2uL7g4Qbt3Ywuc 21TM/xz7vbKbTZTukefkSsFWU0PNfXTUX23eq893PFKFowjVeYQX6IFsZ+Wnv8PMuIzr VKXcYArwEtY/xgksK0hvo2lJueCxs5PrmWWbQoCZ7Pdy26XRFtrT8CX4BeRSWMiEjqKN 9hNA== 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 h38si5413264qvc.155.2019.06.16.08.00.31 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 16 Jun 2019 08:00:31 -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]:40516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcWdy-0003NC-VR for patch@linaro.org; Sun, 16 Jun 2019 11:00:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36572) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcW9i-0005Q9-JP for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hcW9g-0002Yf-Kp for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:14 -0400 Received: from mail03.asahi-net.or.jp ([202.224.55.15]:60452) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hcW9c-00027z-Li for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:08 -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 B01DA49F25; Sun, 16 Jun 2019 23:28:48 +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 6E84D240086; Sun, 16 Jun 2019 23:28:48 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Date: Sun, 16 Jun 2019 23:28:23 +0900 Message-Id: <20190616142836.10614-12-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190616142836.10614-1-ysato@users.sourceforge.jp> References: <20190616142836.10614-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 Subject: [Qemu-devel] [PATCH v20 11/24] 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: peter.maydell@linaro.org, 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.11.0 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 Sun Jun 16 14:28:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 166954 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1785338ilk; Sun, 16 Jun 2019 07:41:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5bnVklin3ZasgTk59nFI2jV4RqWtPiT2jm56XHCLfZWkFxebPEroq2v6yncbgHYhC0r+P X-Received: by 2002:a37:a743:: with SMTP id q64mr83816777qke.236.1560696080331; Sun, 16 Jun 2019 07:41:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560696080; cv=none; d=google.com; s=arc-20160816; b=m/n5nAOKFoV6gEUyPXQyAzGC1ceCK2mE2EB0wMHYtMQzteRXeePVTTlj+ZXUiLUMWx 59Pb8mS2/5Rkq1Zhwxs+06TUrcBlZSPrpZYtiJyn1aaocgPmbVknmL5MiADSDLkYTcwo x5NZaZWnxrif/ypDZqwkC9DOQtzcUXwCVy17Qp+eSvh/Co/7K7ATfdbKTg9LSHhptnTO q0QGhKs5L54DeMnGdC5ydzofLw2m+OpWIKLs/yObro50Z51QHAJqaMViL1r7mvFXXZ8G B/fISpJUa015591j1zZ0O0urMn47UyBGBGKz3VFCYc0xP7fnPMrdQgyLqbqyr8kCjSPl Y+Iw== 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=VNx9Ajp99J+k2CxoHG8xzhuyro4Mwnnw0aZqs91u9dM=; b=cTDZXSJgMFUnvFymuxHVYjBvhnoIn983l+NOgAFcacS3pw3OnaRLGnyp2R/zYZzRNn 8V23wWeV6DbQkbI8UMG6fUols9QmHeyd2WIEqaxn8ZWxhKalPLTUwzPO6YsXS8fQWZ3b EMFjhj8wDpAZf1wt27AZAuUbZd73iI9NTMmpJlykN2WWSLOp36gwv0EnGs9F7eL+5vuI cvTLBY88HVfiOwhnVbXwxAucHEnkmFQxoZhx0+u/RhmpnN3kwtvGKFzsLtF5w+f9ywjD MX6QyU2CCnvtAdS83fHD2E55dqOEaKNZQ4gPi9Tbm+VTzs1riPOPicbMWlsP9aW7bNuW Tp1g== 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 d18si5347578qtj.19.2019.06.16.07.41.20 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 16 Jun 2019 07:41:20 -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]:40396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcWLP-0006Yq-Vs for patch@linaro.org; Sun, 16 Jun 2019 10:41:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36353) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcW9X-0005KG-Qp for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hcW9W-0002Mn-Lq for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:03 -0400 Received: from mail01.asahi-net.or.jp ([202.224.55.13]:54570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hcW9W-00028b-CY for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:02 -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 mail01.asahi-net.or.jp (Postfix) with ESMTPA id 05423125F47; Sun, 16 Jun 2019 23:28:49 +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 AA596240085; Sun, 16 Jun 2019 23:28:48 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Date: Sun, 16 Jun 2019 23:28:24 +0900 Message-Id: <20190616142836.10614-13-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190616142836.10614-1-ysato@users.sourceforge.jp> References: <20190616142836.10614-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.13 Subject: [Qemu-devel] [PATCH v20 12/24] 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: peter.maydell@linaro.org, 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.11.0 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 Sun Jun 16 14:28:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 166955 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1786041ilk; Sun, 16 Jun 2019 07:42:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+PzjFkWohn3GRjK1FLVWBaKUdiUUIDx2nnotsG+iUlcoz13SycCufUaT37TTkF8iO+G8b X-Received: by 2002:ae9:ebd1:: with SMTP id b200mr85756277qkg.152.1560696136048; Sun, 16 Jun 2019 07:42:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560696136; cv=none; d=google.com; s=arc-20160816; b=UNsVOJM+3S8127LvX4OFz58i9CyD+VZFDvXA1MGW4TPbAPHvNaoX9C8nBz1cSDdnmn kWe1musQi3FCD9kISGybcyQ9RtCa0FWMhtaIVsUzinaBu7Lb86THfHG/GPtWOiVNwglv JOfdY9UPURnqUwOHM4l8KzT5nktEJINV0LnoXpCOV3jt7NoHpJZvwSxamUxJFZm5Ol7V 4tuHxYYul7APRLPi5eAH02u5hnseu0db6OGIRbCo1vR4A+DA0ppZRU0SsAfC6C5dyKfb cpQRAGSSshjJFBmg71Qm0cTZuLurlMWew6BT+8dZoRMmfyr5lb9REF/ESe1+51VrtQ03 UVQw== 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=WTgAchzxuRanviydbtTayWihIIXZsydUrp9wH71Hxc4=; b=AH7Oszm8DoBGb+6D+Qq/99CfmGJobqqzYHrYPAEK1HsmhXA/hwyQlfYM8iNBwPsKrz b425L9UT1fuKgrh8V76sflpqOdHvpaCz0ecXuiUJbmszZaAfQwzQkHXLtgP6DNvNKc3U 9mQe2nDYckXCDzi98sNKWNuWxVAj/rW9falfGVtB0zPFNxwvHDY0LgJ2IAm8IFvyjo9L CyrOSIcyUEtF8SKBCbGc6EZX5S9/oDsEZ98+nK/j9xax+P3WcvTUWy1mKJ0cFX7Z3sRG UrcVQiRIbb90t0g1Ki/oh8btLFMTggAN4TnFVHEKMaIhKPNPyrex4neARx3BNP4wxmgX V7TQ== 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 z52si5789424qvc.58.2019.06.16.07.42.15 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 16 Jun 2019 07:42:16 -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]:40398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcWMJ-0006kW-MQ for patch@linaro.org; Sun, 16 Jun 2019 10:42:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36372) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcW9Y-0005LH-DX for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hcW9W-0002NH-VP for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:04 -0400 Received: from mail03.asahi-net.or.jp ([202.224.55.15]:60461) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hcW9W-0002AU-IJ for qemu-devel@nongnu.org; Sun, 16 Jun 2019 10:29:02 -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 A71C649FFA; Sun, 16 Jun 2019 23:28:50 +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 63C5F240085; Sun, 16 Jun 2019 23:28:50 +0900 (JST) From: Yoshinori Sato To: qemu-devel@nongnu.org Date: Sun, 16 Jun 2019 23:28:30 +0900 Message-Id: <20190616142836.10614-19-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190616142836.10614-1-ysato@users.sourceforge.jp> References: <20190616142836.10614-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 Subject: [Qemu-devel] [PATCH v20 18/24] 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: peter.maydell@linaro.org, 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 Signed-off-by: Yoshinori Sato --- hw/rx/rx62n.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/hw/rx/rx62n.c b/hw/rx/rx62n.c index 74d2fd0ee3..05d82d0b8f 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); + } } /* Initialize CPU */