From patchwork Tue Oct 25 19:03:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 9395239 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 439CF60DE8 for ; Tue, 25 Oct 2016 19:09:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3852A2972D for ; Tue, 25 Oct 2016 19:09:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D3012972F; Tue, 25 Oct 2016 19:09:27 +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 0605D2972D for ; Tue, 25 Oct 2016 19:09:25 +0000 (UTC) Received: from localhost ([::1]:57637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bz76B-0001T4-RA for patchwork-qemu-devel@patchwork.kernel.org; Tue, 25 Oct 2016 15:09:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46435) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bz70c-0005qU-4E for qemu-devel@nongnu.org; Tue, 25 Oct 2016 15:03:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bz70b-0007mg-7m for qemu-devel@nongnu.org; Tue, 25 Oct 2016 15:03:38 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:58171) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bz70a-0007mH-Ur for qemu-devel@nongnu.org; Tue, 25 Oct 2016 15:03:37 -0400 Received: from Quad.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue101) with ESMTPSA (Nemesis) id 0LtX2S-1cxV6C04WK-010sjj; Tue, 25 Oct 2016 21:03:28 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 25 Oct 2016 21:03:00 +0200 Message-Id: <1477422199-11208-5-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> MIME-Version: 1.0 X-Provags-ID: V03:K0:bB0QWhnVvVyg8q4Jmz8lfpnNZepUMldR0iJv7d1gp5xjtPvDPeq raCmv+eeMJA+5w858j1+UjkSl0PbUkqcaqOZlgkGgMsHqoGy4BBX8409KKHI1DEvDdfYQCC ZdUoRc5m8POL64A77JWYAPo4UcwPTv4XYlsn8xk/1PaLSQx1A1mEuBt6HTXx1b4rIlzDjU5 N4KlnXsbW7v5Wm5aA9xFA== X-UI-Out-Filterresults: notjunk:1; V01:K0:TrpCI5T74Lo=:AJM5tT81M/HCEn0+QRYbw+ dE02vzhIupd//UZ8uKxTE+MPZFQOt6y2vNu6NvszTXaG9mMbAeGkU/PfWwE3Wa8jN23X3+ZwF maRb7FpYWqVModN55ET1w8sfye761Hug7hkurGsMmbF07Lb1E97DCjk+di1Xns1MYdix2bTDC pNeMe53iGURQVdnJY6k8TUAkrewmT+cmknbazqmuZqNpnrKPb36wgpto1Bz+TyuqeKOsXPki0 5VTg9sl1Y5i/VxMqLTmd4b8ExFqI2GuR26jsqz8Xhbpv9+13OyX76Z9Psud2sDLSW8SBDeGmP ymk6CgF8u6TgR5UCr5etAA7iRlSZMBqfEHkI2SSsUSBlT96p2bNI74ONH0myf9Zx2/DQ/MARw 29Rpwyv3b/Pc9U8efVDVB55r86WRL7XcQjKHcg395MwvgzpwWAc+S5X2Ru2pbeBTFotXoqNsH A01LIhzrV20aj641Mi92ybuUb2fjAXE8dPqaOs3XHhmqNx6XfDWmwyQq8bRYuiMCE9fof0LPt aUDHk1yJ6EVy2M9usBCR1OIZA028wT+tdmMcA3Y6l5YJ1eO2ER7bWQQBKqozb/tGxQP9REO5G gmkgNbYGcMLFnvPZ3A9LoRKXF0D4BEsK3jNOtpDY8JFjr4IoKrrzgMmBqM5cDooiUu2rkYOQT 1S3s/xBawJUj4c5equNzO8/vNKMBzowt23kuhfPBCqVc1vM8HgV+3BSqRFyMPCGclWYrhXpd3 FjPv1XoyglYROk1y X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.73 Subject: [Qemu-devel] [PULL 04/23] target-m68k: manage scaled index 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 Scaled index is not supported by 68000, 68008, and 68010. EA = (bd + PC) + Xn.SIZE*SCALE + od Ignore it: M68000 FAMILY PROGRAMMER’S REFERENCE MANUAL 2.4 BRIEF EXTENSION WORD FORMAT COMPATIBILITY "If the MC68000 were to execute an instruction that encoded a scaling factor, the scaling factor would be ignored and would not access the desired memory address. The earlier microprocessors do not recognize the brief extension word formats implemented by newer processors. Although they can detect illegal instructions, they do not decode invalid encodings of the brief extension word formats as exceptions." Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson --- target-m68k/translate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target-m68k/translate.c b/target-m68k/translate.c index 3773fb4..d73350c 100644 --- a/target-m68k/translate.c +++ b/target-m68k/translate.c @@ -315,6 +315,11 @@ static TCGv gen_lea_indexed(CPUM68KState *env, DisasContext *s, TCGv base) if ((ext & 0x800) == 0 && !m68k_feature(s->env, M68K_FEATURE_WORD_INDEX)) return NULL_QREG; + if (m68k_feature(s->env, M68K_FEATURE_M68000) && + !m68k_feature(s->env, M68K_FEATURE_SCALED_INDEX)) { + ext &= ~(3 << 9); + } + if (ext & 0x100) { /* full extension word format */ if (!m68k_feature(s->env, M68K_FEATURE_EXT_FULL))