From patchwork Sun Jun 11 23:16:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 774394 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wmBl15QZJz9rxm for ; Mon, 12 Jun 2017 09:17:33 +1000 (AEST) Received: from localhost ([::1]:35433 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKC6r-0001yf-2g for incoming@patchwork.ozlabs.org; Sun, 11 Jun 2017 19:17:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37151) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKC6O-0001yU-9d for qemu-devel@nongnu.org; Sun, 11 Jun 2017 19:17:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dKC6L-0007zN-3O for qemu-devel@nongnu.org; Sun, 11 Jun 2017 19:17:00 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:60424) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dKC6K-0007ys-Od for qemu-devel@nongnu.org; Sun, 11 Jun 2017 19:16:57 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.167]) with ESMTPSA (Nemesis) id 0Lv6ko-1e2ZFs17eU-010O2X; Mon, 12 Jun 2017 01:16:38 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Mon, 12 Jun 2017 01:16:30 +0200 Message-Id: <20170611231633.32582-5-laurent@vivier.eu> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170611231633.32582-1-laurent@vivier.eu> References: <20170611231633.32582-1-laurent@vivier.eu> X-Provags-ID: V03:K0:5/MvS41COQSMzx4kGm0kasrCaAGeO56hN5XvE+Qzgn0aPjIqSLX u6uQcBpwLSc5UbKpRuP+W/YP+P2n37xjfM3G5mi8d8wuyZry5ULzv6qtjiGiZN+cCSIeD6z CGJJXM1AoVfgFbB5wAXE+IopxQ1DCTHKM7+HBhpqHbKKqtdI7VGi+q2bVOlGFxZ0xrionER Oq1bxM8JlcvgVHcKczDGA== X-UI-Out-Filterresults: notjunk:1; V01:K0:E4YZn5YG2yg=:el82tn9wuue0HB8bJw+0EE Jbyf/tA2owi41QHlDqIWTxv73KSAoHHXC1mZaJq6VyQ3ek9CR1JEYDwCuQLmts1NQ6peCjPQE 8aCCGgB7K8m3UZEcWKj4ZuPidi8HNtSs/96/6LBOmqHmeHnRbSxE3MC1UwNiSgFB6v1OPyFQi Ndvm7FmojaIFkjtccoKWN/Isaxj2v7H4uw6Ed5Eo1/xnmet8PbcGUogyybHqCKMaCdQs295wL 9egtKjCshbFxHk7tdHoIiK/vv7M/Fg24Ga1mmHSkogd3jhSIGUp9hAS/kdbNFSxlWtTubQ1ux 72mvaVp0PdtGefyb/finuconHbZCayTJSK4m3TD1LIS21xjK3hVh/csias9121582ZXW/Fm5z Yy76PpGYwkiIuTviPoTimFzugo43BzaTOM1a9/WgaujC3xsAEbGrnL4IW2ybvemWc5/8SlAy7 zaTRhql5MhinTo+0RNGw3SOEMLWjKqC6X811/+oIHzD0R/UMAxAzPUlVv3GFvHUVWLgyTracS LVbf1TmT1pV2BcdN4GnCP67Klqe2ixC5i4A7Gh9hAl4BL/LcbpqW91n1LRaAXqOwTOc69NAOA zKZmK3oonxqZVNFnbQQGixDmTV/REECDTMLKwXfVspsSAcEnXr3bsj5sPKe/EdELsjHjUwRmM tPZjw0Ph/5A7enGJVmg81CfoOEo0YNJN0zLWMOCsYAaoG3i9Ug9JFfOvPJT4QDjzbRl4= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.134 Subject: [Qemu-devel] [PATCH v4 4/7] target-m68k: move fmove CR to a function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move code of fmove to/from control register to a function Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson --- target/m68k/translate.c | 66 ++++++++++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 049d837..45733ce 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -4099,6 +4099,45 @@ DISAS_INSN(trap) gen_exception(s, s->pc - 2, EXCP_TRAP0 + (insn & 0xf)); } +static void gen_op_fmove_fcr(CPUM68KState *env, DisasContext *s, + uint32_t insn, uint32_t ext) +{ + int mask = (ext >> 10) & 7; + int is_write = (ext >> 13) & 1; + TCGv val; + + if (is_write) { + switch (mask) { + case 1: /* FPIAR */ + case 2: /* FPSR */ + default: + cpu_abort(NULL, "Unimplemented: fmove from control %d", mask); + goto undef; + case 4: /* FPCR */ + val = tcg_const_i32(0); + DEST_EA(env, insn, OS_LONG, val, NULL); + tcg_temp_free(val); + break; + } + return; + } + switch (mask) { + case 1: /* FPIAR */ + case 2: /* FPSR */ + default: + cpu_abort(NULL, "Unimplemented: fmove to control %d", + mask); + break; + case 4: /* FPCR */ + /* Not implemented. Ignore writes. */ + break; + } + return; +undef: + s->pc -= 2; + disas_undef_fpu(env, s, insn); +} + /* ??? FP exceptions are not implemented. Most exceptions are deferred until immediately before the next FP instruction is executed. */ DISAS_INSN(fpu) @@ -4177,32 +4216,9 @@ DISAS_INSN(fpu) tcg_temp_free_i32(tmp32); return; case 4: /* fmove to control register. */ - switch ((ext >> 10) & 7) { - case 4: /* FPCR */ - /* Not implemented. Ignore writes. */ - break; - case 1: /* FPIAR */ - case 2: /* FPSR */ - default: - cpu_abort(NULL, "Unimplemented: fmove to control %d", - (ext >> 10) & 7); - } - break; case 5: /* fmove from control register. */ - switch ((ext >> 10) & 7) { - case 4: /* FPCR */ - /* Not implemented. Always return zero. */ - tmp32 = tcg_const_i32(0); - break; - case 1: /* FPIAR */ - case 2: /* FPSR */ - default: - cpu_abort(NULL, "Unimplemented: fmove from control %d", - (ext >> 10) & 7); - goto undef; - } - DEST_EA(env, insn, OS_LONG, tmp32, NULL); - break; + gen_op_fmove_fcr(env, s, insn, ext); + return; case 6: /* fmovem */ case 7: {