From patchwork Tue Oct 25 14:50:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 9394725 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 42E5A6077F for ; Tue, 25 Oct 2016 15:07:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35FF429633 for ; Tue, 25 Oct 2016 15:07:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A76C29636; Tue, 25 Oct 2016 15:07:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id C0C6929633 for ; Tue, 25 Oct 2016 15:07:44 +0000 (UTC) Received: from localhost ([::1]:55270 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bz3KK-0005WV-23 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 25 Oct 2016 11:07:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bz33s-0008Uo-3D for qemu-devel@nongnu.org; Tue, 25 Oct 2016 10:50:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bz33n-0005zb-Qm for qemu-devel@nongnu.org; Tue, 25 Oct 2016 10:50:44 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:65485) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bz33n-0005xu-7O for qemu-devel@nongnu.org; Tue, 25 Oct 2016 10:50:39 -0400 Received: from Quad.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue003) with ESMTPSA (Nemesis) id 0Lsupa-1cvwMS2Xta-012Uo7; Tue, 25 Oct 2016 16:50:34 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 25 Oct 2016 16:50:11 +0200 Message-Id: <1477407021-30755-14-git-send-email-laurent@vivier.eu> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477407021-30755-1-git-send-email-laurent@vivier.eu> References: <1477407021-30755-1-git-send-email-laurent@vivier.eu> X-Provags-ID: V03:K0:WNMlwz0ShWnKzkr3fjGk/OELttDclAJED3Ze8YviVj5XPUXSIFt z3OOppEWkEgQs0skCc5ka9oM70GY+8frYOJ2dVoVNvk9eMMaByHmwNyZFH+hMVUjXRwC39J UH5EsevjyJ3Iyrct4YZ04kfvp2lidN/DoosD5Z+Gt6IYAxpdAqi8MNZ1mdiTVhN6hWCOwRb 0i4VGoCqSKdzby9cRxNSQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:ecsDk3JHdiw=:rxyZamZQ0TUemV6EDWWIe9 YRwu8y6PTney2rigYOo6mHm3KY4Q5vHXbUeZtU4OWFCBar4O5mB3/leIuM2JLVbCZAiZdSKjq O8ttKJyhl6BS+ksJ5soG1n+anrBuvRV9h6AAacqyKIWFcpnxWiUo3ZWld+y+I1/d9Fd/n+7uy HUee5AnTQU4pPEc6CbQXHMFDXFYuvmY3+L43Lu7dAQ5lVAvFevtNPDD8r7eW0Dj59+bxZSh2C g8avsNZNbEUBVCAOLyYP8b+hPgxLhW0J+cEnTzaC4S+zFYc77u91ItnGHmptAC6JgXRefsk83 JpWvLTX0D7o2oQJasZiXISHvGzpexZTRhMYYwbjN19KvI6xPH3EeXI+0yjQ4QnakJIgd4cS6O B53oS71SYT8X8PqxqYbuoigdAL+fgbMr3Ydgr9tQnetbSAQnNRBDfjFuLnn3u2FN/fqIixLCY Z10kXmLMF6oz7oO0YuCMLujpFvG/nAKkV0TozFVEeO0n+Mv3NYQkul4SqZzxCRVtZHHwpuxPt /GPcHcTBHgji8T/qdvX5/KJTrO6P51exQoo6MCXgyl7BBkQZhJU/5lHUHmfiKmDeFnFdpnp2/ YZDU2467WaHv5omXia0Eo53C+chgsxGaKmsSR8xrhs4ptBRUWoGSpA5jjhv68BueiTOXYp3v0 L2RNkY//Yf37GACYMKUc3HTXUuUSoJfZ/QYqBgjua/4rXY7yH86B43HmpQQuv3W1e5CQ= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.135 Subject: [Qemu-devel] [PATCH 13/23] target-m68k: update move to/from ccr/sr 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, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson --- target-m68k/translate.c | 53 ++++++++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/target-m68k/translate.c b/target-m68k/translate.c index 681f3a8..37faefe 100644 --- a/target-m68k/translate.c +++ b/target-m68k/translate.c @@ -1368,12 +1368,10 @@ static TCGv gen_get_ccr(DisasContext *s) DISAS_INSN(move_from_ccr) { - TCGv reg; TCGv ccr; ccr = gen_get_ccr(s); - reg = DREG(insn, 0); - gen_partset_reg(OS_WORD, reg, ccr); + DEST_EA(env, insn, OS_WORD, ccr, NULL); } DISAS_INSN(neg) @@ -1400,37 +1398,31 @@ static void gen_set_sr_im(DisasContext *s, uint16_t val, int ccr_only) } } -static void gen_set_sr(CPUM68KState *env, DisasContext *s, uint16_t insn, - int ccr_only) +static void gen_set_sr(DisasContext *s, TCGv val, int ccr_only) { TCGv tmp; - TCGv reg; + tmp = tcg_temp_new(); + tcg_gen_andi_i32(QREG_CC_DEST, val, 0xf); + tcg_gen_shri_i32(tmp, val, 4); + tcg_gen_andi_i32(QREG_CC_X, tmp, 1); + if (!ccr_only) { + gen_helper_set_sr(cpu_env, val); + } +} +static void gen_move_to_sr(CPUM68KState *env, DisasContext *s, uint16_t insn, + int ccr_only) +{ + TCGv src; s->cc_op = CC_OP_FLAGS; - if ((insn & 0x38) == 0) - { - tmp = tcg_temp_new(); - reg = DREG(insn, 0); - tcg_gen_andi_i32(QREG_CC_DEST, reg, 0xf); - tcg_gen_shri_i32(tmp, reg, 4); - tcg_gen_andi_i32(QREG_CC_X, tmp, 1); - if (!ccr_only) { - gen_helper_set_sr(cpu_env, reg); - } - } - else if ((insn & 0x3f) == 0x3c) - { - uint16_t val; - val = read_im16(env, s); - gen_set_sr_im(s, val, ccr_only); - } - else - disas_undef(env, s, insn); + SRC_EA(env, src, OS_WORD, 0, NULL); + gen_set_sr(s, src, ccr_only); } + DISAS_INSN(move_to_ccr) { - gen_set_sr(env, s, insn, 1); + gen_move_to_sr(env, s, insn, 1); } DISAS_INSN(not) @@ -1957,16 +1949,14 @@ DISAS_INSN(strldsr) DISAS_INSN(move_from_sr) { - TCGv reg; TCGv sr; - if (IS_USER(s)) { + if (IS_USER(s) && !m68k_feature(env, M68K_FEATURE_M68000)) { gen_exception(s, s->pc - 2, EXCP_PRIVILEGE); return; } sr = gen_get_sr(s); - reg = DREG(insn, 0); - gen_partset_reg(OS_WORD, reg, sr); + DEST_EA(env, insn, OS_WORD, sr, NULL); } DISAS_INSN(move_to_sr) @@ -1975,7 +1965,7 @@ DISAS_INSN(move_to_sr) gen_exception(s, s->pc - 2, EXCP_PRIVILEGE); return; } - gen_set_sr(env, s, insn, 0); + gen_move_to_sr(env, s, insn, 0); gen_lookup_tb(s); } @@ -2872,6 +2862,7 @@ void register_m68k_insns (CPUM68KState *env) BASE(clr, 4200, ff00); BASE(undef, 42c0, ffc0); INSN(move_from_ccr, 42c0, fff8, CF_ISA_A); + INSN(move_from_ccr, 42c0, ffc0, M68000); INSN(neg, 4480, fff8, CF_ISA_A); INSN(neg, 4400, ff00, M68000); INSN(undef, 44c0, ffc0, M68000);