From patchwork Wed May 4 21:21:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 9018961 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7A9AE9F39D for ; Wed, 4 May 2016 21:28:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD88E203E6 for ; Wed, 4 May 2016 21:28:40 +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 32EBF203DF for ; Wed, 4 May 2016 21:28:40 +0000 (UTC) Received: from localhost ([::1]:50404 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ay4LU-0004Lj-9i for patchwork-qemu-devel@patchwork.kernel.org; Wed, 04 May 2016 17:28:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ay4FF-0000iu-3y for qemu-devel@nongnu.org; Wed, 04 May 2016 17:22:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ay4F3-0006Z8-Ih for qemu-devel@nongnu.org; Wed, 04 May 2016 17:22:03 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:65425) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ay4F3-0006RD-9M for qemu-devel@nongnu.org; Wed, 04 May 2016 17:21:57 -0400 Received: from Quad.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue104) with ESMTPSA (Nemesis) id 0Lu4L0-1bgdpv0UYo-011VTk; Wed, 04 May 2016 23:21:45 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 4 May 2016 23:21:09 +0200 Message-Id: <1462396869-22424-13-git-send-email-laurent@vivier.eu> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1462396869-22424-1-git-send-email-laurent@vivier.eu> References: <1462392752-17703-1-git-send-email-laurent@vivier.eu> <1462396869-22424-1-git-send-email-laurent@vivier.eu> X-Provags-ID: V03:K0:31rR9jwSoYYbL4KvGU7YCU24AwVgpgYWULENRSmwQIHGeXbULe0 o6hQSa3LcISGKI4TWufz3URbmBHjGXKpCpp2fdqhX1XOj7Mer/v3p6Z3iD0hazvSeOreukY O8Ejaf/ZZ0TutCF81FIowlfyscQKlV6P8Ji2MfAtfK+T76vK8OzZt5L3CaHEWph7TbFJjw9 uYYvPhtt3VEMA5oIIuNhQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:PnJWGY54Rjw=:z9OMpunQ+zMom+mqftITdL GxXUnyNJFkwvtMSMUCAFhd8lQlMyIVTM9Qgo1DKCQxeYR952LGFs8X4N4OgSXbPNcwj6rLHgo 6hrqFMFJs9GZvLexTlk7zEAR+/JtUibfFbjiZcz1R01PrH2xSHYsVRQmWGe706Zw7Y9FPO4x3 tZF1XQfHJDXaCLgY3LZWUIUU4+nQys9PSuKTEHE4BIdD2FABFMKaNqgUSB33TBl931gmw8fzw S41DvQyKAKRbxrzoD9ZF0UXxjnKKZhGij5Mh5vzVMbELuVxW0ZI3znrjcC/neoHNXj7m8sPs7 g7cOqSoGm438NIEQaSjI4w9LZOVsDW9ZDs2XdMoW3NLHdCRLCaeZ7qV5A1igQ2SZXyKQOmhkf YykITcWJkdRTBcltVcbTgjl2imSuTehlMk9/gGUXorgDDW624AFc5NmH9uEo0pk61OrOf1r1d oIXko62XhrTM3n96bohUs1rf6r8E11AZ8HskdWVePWtAhH3PlerxC0RfpG6fnuVoN8IEtgp6i VBcf/xLVRM/sj+C30PGtw79sJAZrHM91aSpMxeeAqSZpLOLLAIgBk8G+VKq286XCDV+clBzk5 rvz8PqvXTDg5C2CXDzhIuCuZEj06nCpyDH8zWV7kTOtm5S+2CJNs60fUjoURiU7WRiv6SIICx h7GFg/OEk5BasNyiCcifLIJ0ngJCWASu997164EWPkdywWGI0j/o6IYYU8ZqYGOZJizs= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.75 Subject: [Qemu-devel] [PATCH 52/52] target-m68k: sr/ccr cleanup 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 , gerg@uclinux.org, schwab@linux-m68k.org, agraf@suse.de, rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 Signed-off-by: Laurent Vivier --- target-m68k/translate.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/target-m68k/translate.c b/target-m68k/translate.c index 2d92bdd..4f3e8ca 100644 --- a/target-m68k/translate.c +++ b/target-m68k/translate.c @@ -2239,29 +2239,29 @@ static void gen_set_sr_im(DisasContext *s, uint16_t val, int ccr_only) set_cc_op(s, CC_OP_FLAGS); } -static void gen_set_sr(DisasContext *s, TCGv val, int ccr_only) +static void gen_set_sr(CPUM68KState *env, DisasContext *s, uint16_t insn, + int ccr_only) { - if (ccr_only) { - gen_helper_set_ccr(cpu_env, val); + if ((insn & 0x38) == 0) { + if (ccr_only) { + gen_helper_set_ccr(cpu_env, DREG(insn, 0)); + } else { + gen_helper_set_sr(cpu_env, DREG(insn, 0)); + } + set_cc_op(s, CC_OP_FLAGS); + } else if ((insn & 0x3f) == 0x3c) { + uint16_t val; + val = read_im16(env, s); + gen_set_sr_im(s, val, ccr_only); } else { - gen_helper_set_sr(cpu_env, val); + disas_undef(env, s, insn); } - set_cc_op(s, CC_OP_FLAGS); -} - -static void gen_move_to_sr(CPUM68KState *env, DisasContext *s, uint16_t insn, - int ccr_only) -{ - TCGv src; - - SRC_EA(env, src, OS_WORD, 0, NULL); - gen_set_sr(s, src, ccr_only); } DISAS_INSN(move_to_ccr) { - gen_move_to_sr(env, s, insn, 1); + gen_set_sr(env, s, insn, 1); } DISAS_INSN(not) @@ -3901,7 +3901,7 @@ DISAS_INSN(move_to_sr) gen_exception(s, s->pc - 2, EXCP_PRIVILEGE); return; } - gen_move_to_sr(env, s, insn, 0); + gen_set_sr(env, s, insn, 0); gen_lookup_tb(s); } @@ -4652,8 +4652,9 @@ DISAS_INSN(macsr_to_ccr) { TCGv tmp = tcg_temp_new(); tcg_gen_andi_i32(tmp, QREG_MACSR, 0xf); - gen_set_sr(s, tmp, 1); + gen_helper_set_sr(cpu_env, tmp); tcg_temp_free(tmp); + set_cc_op(s, CC_OP_FLAGS); } DISAS_INSN(to_mac)