From patchwork Tue Oct 25 14:50:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 9394749 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 74A756077F for ; Tue, 25 Oct 2016 15:09:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 681CC29412 for ; Tue, 25 Oct 2016 15:09:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C17A29644; Tue, 25 Oct 2016 15:09:01 +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 DC5C729412 for ; Tue, 25 Oct 2016 15:09:00 +0000 (UTC) Received: from localhost ([::1]:55277 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bz3LX-0006aZ-Qr for patchwork-qemu-devel@patchwork.kernel.org; Tue, 25 Oct 2016 11:08:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bz33p-0008SV-K7 for qemu-devel@nongnu.org; Tue, 25 Oct 2016 10:50:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bz33k-0005wX-Mh for qemu-devel@nongnu.org; Tue, 25 Oct 2016 10:50:41 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:61289) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bz33k-0005vY-Cw for qemu-devel@nongnu.org; Tue, 25 Oct 2016 10:50:36 -0400 Received: from Quad.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue003) with ESMTPSA (Nemesis) id 0LwVKN-1cyx211qPf-018HhG; Tue, 25 Oct 2016 16:50:30 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 25 Oct 2016 16:50:05 +0200 Message-Id: <1477407021-30755-8-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:ZJCCeYWGzPNaAG9xmLU4yK1qIjV2EI1ZHCK6AeP6x7qZTuIBE1Z XG7mRlJqQto3jd7XP1lbLHgaoglJC13+oBjtacgdd1clsfS8X2HEZ6VM3BPsyXpT6vSkKDL 6iueFlwnmnpxk/zh+dEO8mkL6tBwE1XODZIWP27fdfwmiFdnCKmaXMmkZ+JUPr7c47wwTxd 0AFw+jdhCxCbC/rCB+baA== X-UI-Out-Filterresults: notjunk:1; V01:K0:cCG0An5diU8=:G+SVv2QMmQ6xtpKQIGv/E+ 7OqlKiJqyHUYkW2Ydk559Mr1WhS012QYyDwfc9QPJF6VNWotjioYLGlaRioZb9G8rfUih125K u5lP944j++A7uUfeptQ0n0QcgqE/iriaBWLXymAaRyopURI8cP0BcNrqyUPYfy1q6F5qsX6AF TVEFXVchIF50LFThKmTRYhJorKcqkywdFMM7zYhEDkvndtTd9LA7jCO8NRJUYqgdVwHKN8Ea2 3GqawIzbn3T6+ean1kXyzqNR/YbUTB+bJKqYW5xLZ2hpM2bCpi9LbE1yzHRzwbfTgcuzSf8SN Iddu/gV1O2xpUpqV/8eagaypqygVgJSvSooY/PQjOL/ZrY3KdWvg2Q4K60cukyH652S2agdRU tkZrYEMMYAx6yDsPm65E9dy7SLU4UecIBnQ98L58V/erLg/Jnw2M6IBHW3HkrkTUzT/BrOMc2 ntJ+UmGEFBLViPoHxAlNlMipOsYx9dmsLVCnr7ji3ZGhm7rNvcDzPg6HqoSBU4ar/jbOSZkti U8XMHD0J3HfeQ5SazlkOI8VrSHo5Tet9zdm3olQTHfEQX2BiVtRrYyqY3whzzC+BChwP2e9oy KONP+OOlqIGmz9goDo5vy2BBl4xaI/gwbvbe6Jr56JgEfTDsGXKnJj/I/zomplICzyPpA98cr 28yBtxWljWroXOHWImwwO+aaip977L1knlbA51b6pWDU6V9LTzLWCZrxJdkOwzv22EHU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.130 Subject: [Qemu-devel] [PATCH 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); }