From patchwork Tue Oct 25 19:03:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 9395263 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 791BA60233 for ; Tue, 25 Oct 2016 19:23:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B227F2972D for ; Tue, 25 Oct 2016 19:23:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A511429730; Tue, 25 Oct 2016 19:23:18 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 EC2E72972D for ; Tue, 25 Oct 2016 19:23:17 +0000 (UTC) Received: from localhost ([::1]:57706 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bz7Jc-0004vl-J0 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 25 Oct 2016 15:23:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bz70p-00060V-7Y for qemu-devel@nongnu.org; Tue, 25 Oct 2016 15:03:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bz70m-0007se-5E for qemu-devel@nongnu.org; Tue, 25 Oct 2016 15:03:51 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:60978) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bz70l-0007r3-RF for qemu-devel@nongnu.org; Tue, 25 Oct 2016 15:03:48 -0400 Received: from Quad.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue101) with ESMTPSA (Nemesis) id 0MS1yk-1cMmyG1YvS-00TBXp; Tue, 25 Oct 2016 21:03:30 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 25 Oct 2016 21:03:03 +0200 Message-Id: <1477422199-11208-8-git-send-email-laurent@vivier.eu> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477422199-11208-1-git-send-email-laurent@vivier.eu> References: <1477422199-11208-1-git-send-email-laurent@vivier.eu> X-Provags-ID: V03:K0:CP2fOETCLUWtyebTd1zCBjBEpHWiHEx4/3CGTDLaUhjocNp4CCD Xijuoc1wdfNvJAWiclea7gq04iNAv33nzjuYtSAC8cnkOTsJuqvNM2Eg+CtgfLLMr6IbAuu RVf1MasVLjAu34OZJeXqyjvHEGo92lTJ9I+jW5A1EtMiEVzdFSH1B5rxED7isox+jraSx6V I7WzbJHEGZ0aoAJq0EbRg== X-UI-Out-Filterresults: notjunk:1; V01:K0:g5+3xyYTYBc=:pO+fH/ur6Lf5JsmxcLVq4T 7NSdZRHrU/X8/7IrM08mp0mkLlSr1IW+qkQyMQB7JWxTDutlPPur38M2iad/y7qclE+A+mgh+ GWPrNmpEcxv4wDA/WSPkjdZZzYjkLfBFGvMD62/GSPxk4W/JASkWTpAXis0fCDgXGnc16965t oYQDrrFg1GH5jYy1TQvadfCu76p2WYUfymjxfymv0AmXX74/Tl0sU23JhIvx2p4q//6o9wK82 u6TWKLem8Y4dnnNBhY01xBStIkWUI+XfpxG6LvwZnx+/buAKFH1A5PPQoHBuaeB4NtGw/sJV7 VJN2I2a27P2p+it5DzNXWpbPvFEF0I2OzaNThWxzZzXiqSt7ZdlFxF551w1WGU0Az1kbhyvw/ e/GVq0yrfCTV5vs6yqEnF56sIL13W9YuOuhpz6krLIPiUYoTKYeFIkbRls8BFTfhmxsmJ5Wph /ciFVhl6uNQeUrC6DNp32lhxeXrH0nmQ3gsIlG2UrCN2QySTqRftyGTTmWVaL651dL+5ZMMgW l3MWqJl5fpJo19qAhan+71i6xc3/paCbBjNhds0e5kwD8VX33aHKsqoqvpp9k9pIykHxK7RoE DEb+ytVTP4AWKuzsE/OD8ovWCZqBq8Rr3rFUo1zUhO/wlT8OfeITriVSFa1lqR1ntTxsV0YdE QLX/pVFzdxVacIl+Wro61OtsKqVNuF6j1DHWELF4vzM/YeKsL6gmITtrmyU1mUIzwt7w= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.24 Subject: [Qemu-devel] [PULL 07/23] target-m68k: define operand sizes 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/cpu.h | 8 ++++++++ target-m68k/translate.c | 47 +++++++++++++++-------------------------------- 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/target-m68k/cpu.h b/target-m68k/cpu.h index 8333e1e..133852a 100644 --- a/target-m68k/cpu.h +++ b/target-m68k/cpu.h @@ -30,6 +30,14 @@ #include "cpu-qom.h" #include "fpu/softfloat.h" +#define OS_BYTE 0 +#define OS_WORD 1 +#define OS_LONG 2 +#define OS_SINGLE 3 +#define OS_DOUBLE 4 +#define OS_EXTENDED 5 +#define OS_PACKED 6 + #define MAX_QREGS 32 #define EXCP_ACCESS 2 /* Access (MMU) error. */ diff --git a/target-m68k/translate.c b/target-m68k/translate.c index a8ff5de..639db76 100644 --- a/target-m68k/translate.c +++ b/target-m68k/translate.c @@ -154,12 +154,6 @@ typedef struct DisasContext { static void *gen_throws_exception; #define gen_last_qop NULL -#define OS_BYTE 0 -#define OS_WORD 1 -#define OS_LONG 2 -#define OS_SINGLE 4 -#define OS_DOUBLE 5 - typedef void (*disas_proc)(CPUM68KState *env, DisasContext *s, uint16_t insn); #ifdef DEBUG_DISPATCH @@ -453,6 +447,19 @@ static inline int opsize_bytes(int opsize) case OS_LONG: return 4; case OS_SINGLE: return 4; case OS_DOUBLE: return 8; + case OS_EXTENDED: return 12; + case OS_PACKED: return 12; + default: + g_assert_not_reached(); + } +} + +static inline int insn_opsize(int insn) +{ + switch ((insn >> 6) & 3) { + case 0: return OS_BYTE; + case 1: return OS_WORD; + case 2: return OS_LONG; default: g_assert_not_reached(); } @@ -1330,19 +1337,7 @@ DISAS_INSN(clr) { int opsize; - switch ((insn >> 6) & 3) { - case 0: /* clr.b */ - opsize = OS_BYTE; - break; - case 1: /* clr.w */ - opsize = OS_WORD; - break; - case 2: /* clr.l */ - opsize = OS_LONG; - break; - default: - abort(); - } + opsize = insn_opsize(insn); DEST_EA(env, insn, opsize, tcg_const_i32(0), NULL); gen_logic_cc(s, tcg_const_i32(0)); } @@ -1486,19 +1481,7 @@ DISAS_INSN(tst) int opsize; TCGv tmp; - switch ((insn >> 6) & 3) { - case 0: /* tst.b */ - opsize = OS_BYTE; - break; - case 1: /* tst.w */ - opsize = OS_WORD; - break; - case 2: /* tst.l */ - opsize = OS_LONG; - break; - default: - abort(); - } + opsize = insn_opsize(insn); SRC_EA(env, tmp, opsize, 1, NULL); gen_logic_cc(s, tmp); }