From patchwork Thu Mar 24 15:49:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongbok Kim X-Patchwork-Id: 8662271 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 13161C0553 for ; Thu, 24 Mar 2016 15:50:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 58CD0203A1 for ; Thu, 24 Mar 2016 15:50:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 87CBE203A0 for ; Thu, 24 Mar 2016 15:50:52 +0000 (UTC) Received: from localhost ([::1]:51165 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj7XA-0003AS-0d for patchwork-qemu-devel@patchwork.kernel.org; Thu, 24 Mar 2016 11:50:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj7Wz-00039j-5P for qemu-devel@nongnu.org; Thu, 24 Mar 2016 11:50:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aj7Wv-0003CV-Pr for qemu-devel@nongnu.org; Thu, 24 Mar 2016 11:50:41 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:49250) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj7Wv-0003By-A6 for qemu-devel@nongnu.org; Thu, 24 Mar 2016 11:50:37 -0400 Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Websense Email Security Gateway with ESMTPS id 4A38BA60E979D; Thu, 24 Mar 2016 15:50:30 +0000 (GMT) Received: from localhost.localdomain (192.168.161.74) by hhmail02.hh.imgtec.org (10.100.10.20) with Microsoft SMTP Server (TLS) id 14.3.266.1; Thu, 24 Mar 2016 15:50:32 +0000 From: Yongbok Kim To: Date: Thu, 24 Mar 2016 15:49:59 +0000 Message-ID: <1458834599-62526-2-git-send-email-yongbok.kim@imgtec.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1458834599-62526-1-git-send-email-yongbok.kim@imgtec.com> References: <1458834599-62526-1-git-send-email-yongbok.kim@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [192.168.161.74] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.59.15.196 Cc: leon.alrae@imgtec.com, aurelien@aurel32.net Subject: [Qemu-devel] [PATCH v2 2/2] target-mips: use CP0_CHECK for gen_m{f|t}hc0 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reuse CP0_CHECK macro for gen_m{f|t}hc0. Signed-off-by: Yongbok Kim --- target-mips/translate.c | 54 +++++++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/target-mips/translate.c b/target-mips/translate.c index f7c6cb3..bc8038b 100644 --- a/target-mips/translate.c +++ b/target-mips/translate.c @@ -4775,13 +4775,18 @@ static inline void gen_mtc0_store32 (TCGv arg, target_ulong off) tcg_temp_free_i32(t0); } +#define CP0_CHECK(c) \ + do { \ + if (!(c)) { \ + goto cp0_unimplemented; \ + } \ + } while (0) + static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel) { const char *rn = "invalid"; - if (!(ctx->hflags & MIPS_HFLAG_ELPA)) { - goto mfhc0_read_zero; - } + CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA); switch (reg) { case 2: @@ -4791,7 +4796,7 @@ static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel) rn = "EntryLo0"; break; default: - goto mfhc0_read_zero; + goto cp0_unimplemented; } break; case 3: @@ -4801,7 +4806,7 @@ static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel) rn = "EntryLo1"; break; default: - goto mfhc0_read_zero; + goto cp0_unimplemented; } break; case 17: @@ -4812,14 +4817,12 @@ static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel) rn = "LLAddr"; break; case 1: - if (!ctx->mrp) { - goto mfhc0_read_zero; - } + CP0_CHECK(ctx->mrp); gen_helper_mfhc0_maar(arg, cpu_env); rn = "MAAR"; break; default: - goto mfhc0_read_zero; + goto cp0_unimplemented; } break; case 28: @@ -4832,18 +4835,18 @@ static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel) rn = "TagLo"; break; default: - goto mfhc0_read_zero; + goto cp0_unimplemented; } break; default: - goto mfhc0_read_zero; + goto cp0_unimplemented; } (void)rn; /* avoid a compiler warning */ LOG_DISAS("mfhc0 %s (reg %d sel %d)\n", rn, reg, sel); return; -mfhc0_read_zero: +cp0_unimplemented: LOG_DISAS("mfhc0 %s (reg %d sel %d)\n", rn, reg, sel); tcg_gen_movi_tl(arg, 0); } @@ -4853,9 +4856,7 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel) const char *rn = "invalid"; uint64_t mask = ctx->PAMask >> 36; - if (!(ctx->hflags & MIPS_HFLAG_ELPA)) { - goto mthc0_nop; - } + CP0_CHECK(ctx->hflags & MIPS_HFLAG_ELPA); switch (reg) { case 2: @@ -4866,7 +4867,7 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel) rn = "EntryLo0"; break; default: - goto mthc0_nop; + goto cp0_unimplemented; } break; case 3: @@ -4877,7 +4878,7 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel) rn = "EntryLo1"; break; default: - goto mthc0_nop; + goto cp0_unimplemented; } break; case 17: @@ -4890,14 +4891,12 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel) rn = "LLAddr"; break; case 1: - if (!ctx->mrp) { - goto mthc0_nop; - } + CP0_CHECK(ctx->mrp); gen_helper_mthc0_maar(cpu_env, arg); rn = "MAAR"; break; default: - goto mthc0_nop; + goto cp0_unimplemented; } break; case 28: @@ -4911,15 +4910,15 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel) rn = "TagLo"; break; default: - goto mthc0_nop; + goto cp0_unimplemented; } break; default: - goto mthc0_nop; + goto cp0_unimplemented; } (void)rn; /* avoid a compiler warning */ -mthc0_nop: +cp0_unimplemented: LOG_DISAS("mthc0 %s (reg %d sel %d)\n", rn, reg, sel); } @@ -4932,13 +4931,6 @@ static inline void gen_mfc0_unimplemented(DisasContext *ctx, TCGv arg) } } -#define CP0_CHECK(c) \ - do { \ - if (!(c)) { \ - goto cp0_unimplemented; \ - } \ - } while (0) - static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel) { const char *rn = "invalid";