From nobody Sat May 18 16:46:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1615501251; cv=none; d=zohomail.com; s=zohoarc; b=W/+TOZBM6HriRcMfXvj1wewmdfEefkoKbb7iCG/iz+4YfVIHDTt4qZjMLqwp/0jLhpnL5AE6qW0Eoj3SHSxGtwbe1O4Gb4hwRqpzl4wo9DzQbpkZJkdhzBNVm+dmwK/Klfy46I+VtejL3yIaypCoOm8wrnhJuyOfOS0V7eFpWdw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615501251; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vkltsa6ZSjbcstfoblKkNPNsJl33zFe7s81r6Z0MiW8=; b=NJHO6Y1fopKlHaePJVDwp8NA6UvusDaXonm/nkbbC8KY+3zkH7MRfUcTvOW9q+8lfi3NK0okTyJzzTqR8l9ya8EMJWAD73BUw0qswRBYvIroU+fJCtsN3zLKJNclLWg/uahTqa5Jnm1j6kvZKUrRTSZcT0YKUJBhd2aT9oWaHkU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615501250920825.8274429515653; Thu, 11 Mar 2021 14:20:50 -0800 (PST) Received: from localhost ([::1]:56094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKTfl-0005iV-Op for importer@patchew.org; Thu, 11 Mar 2021 17:20:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKTdg-0004IO-B2 for qemu-devel@nongnu.org; Thu, 11 Mar 2021 17:18:40 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:59441) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKTdZ-00049f-Jn for qemu-devel@nongnu.org; Thu, 11 Mar 2021 17:18:40 -0500 Received: from localhost.localdomain ([82.142.6.26]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MidPj-1lyjnU1SsR-00fh3e; Thu, 11 Mar 2021 23:18:31 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 1/4] target/m68k: implement rtr instruction Date: Thu, 11 Mar 2021 23:18:24 +0100 Message-Id: <20210311221827.2595898-2-laurent@vivier.eu> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210311221827.2595898-1-laurent@vivier.eu> References: <20210311221827.2595898-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:ftA5stcrvlAqhsHWa+A3/poNsjhxo42xmGxWM2QJ+EXFC1V9wO3 ZJYbGJF86Wek8dPa3l+EJY66ZbXDlmcUKAZ3uDYfpIiIW1OEzKWLL5+I5x4NVxnIgF25srW djVPipRAubtxTkHVbo+jCfLoPIjvXrlxkmrlfHqnNMrbMBLOOaS3VwCPi137Ot5n9bUZsb5 eu8foNfr74DY+rHF17eJA== X-UI-Out-Filterresults: notjunk:1;V03:K0:05nLqMf9n3s=:kPMQ+wTapfgqCmYBh2pSyM ctJz48JF/iAQdL8IzDfya6JhRQigO/b1njB5g3Ee9567xG+siOiQCvpi4xyyvdYUyZ05sRNSk DxZE8KnPsmV3GpTOgS6viJ7rd6gZyR02E0uB0TJjSb05boapOHeCyfVfcFMUvZ3qiO0szdyMv imaH742dAGB9V+QUbANNBLkJF99WLGaJp6aShSOYViI2atzyvV+Ti+8e2zKmxYH0MoaDGArc5 gY0rTBionHRtazXqkCUEMKg0x+7TOO39yAoiVDtcULncFtzEc8uPIw3w8695MtXXQjWkd5rcc oq91SsAdv/VJPtiPrFtZLp8dvpHSJPIHKvukExGqjsh5qCfNlcfMrMXtDPlR8c7U8BLFGMAlg PM3AQwzGW526Q55pUuKRIhONYJYMhyFzGe+PSXh/Lp97htiLRM+HUC7YXMqtJH4/px4nRvCfO 03w7/Ox9zw== Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=212.227.126.130; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Mark Cave-Ayland , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This is needed to boot MacOS ROM. Pull the condition code and the program counter from the stack. Operation: (SP) -> CCR SP + 2 -> SP (SP) -> PC SP + 4 -> SP This operation is not privileged. Reported-by: Mark Cave-Ayland Tested-by: Mark Cave-Ayland Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson Message-Id: <20210307212552.523552-1-laurent@vivier.eu> --- target/m68k/translate.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index ac936ebe8f14..200018ae6a63 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -2969,6 +2969,25 @@ DISAS_INSN(rtd) gen_jmp(s, tmp); } =20 +DISAS_INSN(rtr) +{ + TCGv tmp; + TCGv ccr; + TCGv sp; + + sp =3D tcg_temp_new(); + ccr =3D gen_load(s, OS_WORD, QREG_SP, 0, IS_USER(s)); + tcg_gen_addi_i32(sp, QREG_SP, 2); + tmp =3D gen_load(s, OS_LONG, sp, 0, IS_USER(s)); + tcg_gen_addi_i32(QREG_SP, sp, 4); + tcg_temp_free(sp); + + gen_set_sr(s, ccr, true); + tcg_temp_free(ccr); + + gen_jmp(s, tmp); +} + DISAS_INSN(rts) { TCGv tmp; @@ -6015,6 +6034,7 @@ void register_m68k_insns (CPUM68KState *env) BASE(nop, 4e71, ffff); INSN(rtd, 4e74, ffff, RTD); BASE(rts, 4e75, ffff); + INSN(rtr, 4e77, ffff, M68000); BASE(jump, 4e80, ffc0); BASE(jump, 4ec0, ffc0); INSN(addsubq, 5000, f080, M68000); --=20 2.29.2 From nobody Sat May 18 16:46:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1615501417; cv=none; d=zohomail.com; s=zohoarc; b=ABnoL29DtBHicDMUm1vUA5SJ65rwttEFEBE01iixVjTyrwdIqdyesNn++33GwzKy6nELoIpsT7JeN1gE2R0yoAx2rRti4VXTNjBJnFZt/dhoJ3r0/s9a33cTF82MH1KdIfpiSuSQqZt+5KvR2bW35wkDYM83Wb9hPFeQBcc1ZCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615501417; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ACsF1i8AKwGxOE3tYLU5bYNqGeVpywHusbFN2CtvFk0=; b=S6792ZBziHGUOyVRpfcFyI9WhztX2fAjcuRM3JH7dMUIJqmLwTbsPkxCbBDBhRrT5k6/d38lKtsdsFTjhd1zyLe/yZmVXAf2i7B0ndNuIHLU4+OUvgms7QklAfg3eFXTTVoq42DQZs+q2hoZELNupfSGD240SJ3yVSrWugwuzw4= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615501417367848.9374897242775; Thu, 11 Mar 2021 14:23:37 -0800 (PST) Received: from localhost ([::1]:33442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKTiS-0008PJ-BZ for importer@patchew.org; Thu, 11 Mar 2021 17:23:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKTdh-0004JM-Cw for qemu-devel@nongnu.org; Thu, 11 Mar 2021 17:18:41 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:55263) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKTdZ-00049h-Tm for qemu-devel@nongnu.org; Thu, 11 Mar 2021 17:18:41 -0500 Received: from localhost.localdomain ([82.142.6.26]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MKMIR-1l1Zbk3Bwl-00Lqta; Thu, 11 Mar 2021 23:18:31 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 2/4] target/m68k: don't set SSW ATC bit for physical bus errors Date: Thu, 11 Mar 2021 23:18:25 +0100 Message-Id: <20210311221827.2595898-3-laurent@vivier.eu> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210311221827.2595898-1-laurent@vivier.eu> References: <20210311221827.2595898-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:aziqEioKNGz8LrR5YjW7FPKJaB65L1LkFeuDWZlEiJ+UFC40APB QE/I3qjaTCwId0jqi45vEGeD6to+dYV3lgJr5jyTJRI4ay9daFgVLIBCgjO4CfSiR3C94Ix BH3qMv8uFHwdZ7MkGfD8DFDdJaW0OsMEAjszt2b6xpPSJgqAfxwclGaeo1/cr7lN+8UToD6 q7WCY0QP7wwUtxxA5AFPA== X-UI-Out-Filterresults: notjunk:1;V03:K0:+pfpjRs9zEA=:eVn7Z4cScjlgMNyEwmLXfb n6SirhHWSoVptHi5WxNiq5Y1xutT64gm8rfluGRFDsyMkN1/TAFAnZDsQu93NVG8zY++9i6R4 KXu/TdQetqEgbfyIF1RP/HS0GXS7AaxGJz35DrTTDGEaY6dKGday1GKPhMExs92nHzMm1lBuE n2TvJVRkqTjeW3vK2IRBc/GUUifwX1JjGbW7HN3+v2/VQSyJFm4KbmRjeD1z0jt0SBD0VxFq8 b3Rod1hO9Vux/kvufegOyXVoCKXWEPxfyBFGJfxgv2OWGLPIYSsbzUvhY0alcs2qCAyWHjB21 WWk/Xg9QUNmO8LE/GmGNi4GZWdq44z0+3erYtDCkE8jp+WaPevLz0ZPjMiJZy/WS0Xa9NZjpE UkqbqEbNyCgJ70aEeKdRQ/b8h6ziSjzpNz6MDVV5Zfn39HTDHG3bAdaSJRcZjvtOcnj0fHM7f y2awSK2ZGg== Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=212.227.126.134; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland If a NuBus slot doesn't contain a card, the Quadra hardware generates a phy= sical bus error if the CPU attempts to access the slot address space. Both Linux = and MacOS use a separate bus error handler during NuBus accesses in order to de= tect and recover when addressing empty slots. According to the MC68040 users manual the ATC bit of the SSW is used to distinguish between ATC faults and physical bus errors. MacOS specifically = checks the stack frame generated by a NuBus error and panics if the SSW ATC bit is= set. Update m68k_cpu_transaction_failed() so that the SSW ATC bit is not set if = the memory API returns MEMTX_DECODE_ERROR which will be used to indicate that an access to an empty NuBus slot occurred. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Message-Id: <20210308121155.2476-2-mark.cave-ayland@ilande.co.uk> Signed-off-by: Laurent Vivier --- target/m68k/op_helper.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 730cdf774445..5f981e5bf628 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -468,7 +468,17 @@ void m68k_cpu_transaction_failed(CPUState *cs, hwaddr = physaddr, vaddr addr, =20 if (m68k_feature(env, M68K_FEATURE_M68040)) { env->mmu.mmusr =3D 0; - env->mmu.ssw |=3D M68K_ATC_040; + + /* + * According to the MC68040 users manual the ATC bit of the SSW is + * used to distinguish between ATC faults and physical bus errors. + * In the case of a bus error e.g. during nubus read from an empty + * slot this bit should not be set + */ + if (response !=3D MEMTX_DECODE_ERROR) { + env->mmu.ssw |=3D M68K_ATC_040; + } + /* FIXME: manage MMU table access error */ env->mmu.ssw &=3D ~M68K_TM_040; if (env->sr & SR_S) { /* SUPERVISOR */ --=20 2.29.2 From nobody Sat May 18 16:46:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1615501417; cv=none; d=zohomail.com; s=zohoarc; b=kS8Lahw75K0tTGmVZKD3j/rsi0nPtlYF/ADf/J/piNNX2mOinsV0WPSyq4b8zwUUrQ6rGperwNjZHXa3THwEGnKmmzPhxfcZd+sfGSi9ILNuTZNqHsCiJbFKCt7f8cBMZs1Y3+hUg8EZRVZS5V4y1f2v4C8NF2RvJ0UAhJIDJUM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615501417; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SBQpdbpgoU/6L1ret0H3Hez37+f28XKx1VHiCOn6ZKo=; b=kWLyhLXn4szRwHOXuyFflSOCFqCWTb6mKaBHmjVdTFn+YXx4Tv3f8XQsTCVGWzVkcPR9ENYZa1Q9MV1opCtobc+VHTu96gPTehTNY0WKaeh59UR3e4OlIuv9gZouNzcSNm9yELji7g8bgMaDg241sAxNOcqAV0W7du3LE8mh+qI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615501417609185.8928800152438; Thu, 11 Mar 2021 14:23:37 -0800 (PST) Received: from localhost ([::1]:33444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKTiS-0008PL-JT for importer@patchew.org; Thu, 11 Mar 2021 17:23:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKTdi-0004KU-8E for qemu-devel@nongnu.org; Thu, 11 Mar 2021 17:18:42 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:46663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKTda-00049q-7b for qemu-devel@nongnu.org; Thu, 11 Mar 2021 17:18:42 -0500 Received: from localhost.localdomain ([82.142.6.26]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MoNMu-1m4Ywi0tWS-00okY5; Thu, 11 Mar 2021 23:18:32 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 3/4] target/m68k: reformat m68k_features enum Date: Thu, 11 Mar 2021 23:18:26 +0100 Message-Id: <20210311221827.2595898-4-laurent@vivier.eu> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210311221827.2595898-1-laurent@vivier.eu> References: <20210311221827.2595898-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:jJhmzEZMbApwm0FdxCVUj2ShjGahmvaTThpZVfciltqosyktFOJ 1Lqijb9k5dqpzlaDXCdU9EK3sHFkUFHJNsxO9UvBALCcnJZVBci+S08gbg3/G69CORJQ4Tm aoPw2BbmaH9fBMoOfmT/JfnDqa12j3yQYq/bZxsb5IyfgKFqT5jdnJxAPzI0xJc6gNFyl6D 7udu6YBBnX/PdcZZruCMQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:4xQ3q7aL+Ys=:2I1JS8rSrT5gyOaIxptZcP g6IftZRbKdcV4eCHBu3hhg8eK1lKUC7vgOlQqYJ/CcY6B2KnBlAVBVENiRiS3EFosMGzQOEgF /5mA0qJWEj2jOdZHbotAet/YsgWGwhh19l6Rpl6X83pre4BmNVQx7V8d3WLfnsHhE9E8fSCL/ zJ4dFr9rVAHwZBb/DMWmpOtK+lA6wMFpialo0whbfYApRLBs8swUWalWB260BHAOv/zcATeOL tKDVuwKzR/u785axbaBTwJoM9G97z1/Q2Ddpbg6FqTevnZN+R64f3nHgicvskQSfpnfwWZYxb lEabMsTz5wC61ZQTs+aMQoSwFOPHVhiQsLky5YJ+79HNdUkCG2nznOClMTsyj/6ZjxpJgNdbl YMDRU3NlryCtRmeZIBRYBnE30ojkR/8hkishtfkVFjAzMAH5SmURvucSuUcSPnH0krTC8LSZy OF1WsKwlHg== Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=212.227.126.133; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Mark Cave-Ayland , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland Move the feature comment from after the feature name to the preceding line = to allow for longer feature names and descriptions without hitting the 80 character line limit. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Reviewed-by: Richard Henderson Message-Id: <20210308121155.2476-3-mark.cave-ayland@ilande.co.uk> Signed-off-by: Laurent Vivier --- target/m68k/cpu.h | 66 +++++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 22 deletions(-) diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index 7c3feeaf8a64..ce558e9b03e7 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -475,36 +475,58 @@ void do_m68k_semihosting(CPUM68KState *env, int nr); */ =20 enum m68k_features { - M68K_FEATURE_M68000, /* Base m68k instruction set */ + /* Base m68k instruction set */ + M68K_FEATURE_M68000, M68K_FEATURE_M68010, M68K_FEATURE_M68020, M68K_FEATURE_M68030, M68K_FEATURE_M68040, M68K_FEATURE_M68060, - M68K_FEATURE_CF_ISA_A, /* Base Coldfire set Rev A. */ - M68K_FEATURE_CF_ISA_B, /* (ISA B or C). */ - M68K_FEATURE_CF_ISA_APLUSC, /* BIT/BITREV, FF1, STRLDSR (ISA A+ or C).= */ - M68K_FEATURE_BRAL, /* BRA with Long branch. (680[2346]0, ISA A+ or B).= */ + /* Base Coldfire set Rev A. */ + M68K_FEATURE_CF_ISA_A, + /* (ISA B or C). */ + M68K_FEATURE_CF_ISA_B, + /* BIT/BITREV, FF1, STRLDSR (ISA A+ or C). */ + M68K_FEATURE_CF_ISA_APLUSC, + /* BRA with Long branch. (680[2346]0, ISA A+ or B). */ + M68K_FEATURE_BRAL, M68K_FEATURE_CF_FPU, M68K_FEATURE_CF_MAC, M68K_FEATURE_CF_EMAC, - M68K_FEATURE_CF_EMAC_B, /* Revision B EMAC (dual accumulate). */ - M68K_FEATURE_USP, /* User Stack Pointer. (680[012346]0, ISA A+, B or C= ).*/ - M68K_FEATURE_MSP, /* Master Stack Pointer. (680[234]0) */ - M68K_FEATURE_EXT_FULL, /* 68020+ full extension word. */ - M68K_FEATURE_WORD_INDEX, /* word sized address index registers. */ - M68K_FEATURE_SCALED_INDEX, /* scaled address index registers. */ - M68K_FEATURE_LONG_MULDIV, /* 32 bit mul/div. (680[2346]0, and CPU32) */ - M68K_FEATURE_QUAD_MULDIV, /* 64 bit mul/div. (680[2346]0, and CPU32) */ - M68K_FEATURE_BCCL, /* Bcc with Long branches. (680[2346]0, and CPU32)= */ - M68K_FEATURE_BITFIELD, /* BFxxx Bit field insns. (680[2346]0) */ - M68K_FEATURE_FPU, /* fpu insn. (680[46]0) */ - M68K_FEATURE_CAS, /* CAS/CAS2[WL] insns. (680[2346]0) */ - M68K_FEATURE_BKPT, /* BKPT insn. (680[12346]0, and CPU32) */ - M68K_FEATURE_RTD, /* RTD insn. (680[12346]0, and CPU32) */ - M68K_FEATURE_CHK2, /* CHK2 insn. (680[2346]0, and CPU32) */ - M68K_FEATURE_MOVEP, /* MOVEP insn. (680[01234]0, and CPU32) */ - M68K_FEATURE_MOVEC, /* MOVEC insn. (from 68010) */ + /* Revision B EMAC (dual accumulate). */ + M68K_FEATURE_CF_EMAC_B, + /* User Stack Pointer. (680[012346]0, ISA A+, B or C). */ + M68K_FEATURE_USP, + /* Master Stack Pointer. (680[234]0) */ + M68K_FEATURE_MSP, + /* 68020+ full extension word. */ + M68K_FEATURE_EXT_FULL, + /* word sized address index registers. */ + M68K_FEATURE_WORD_INDEX, + /* scaled address index registers. */ + M68K_FEATURE_SCALED_INDEX, + /* 32 bit mul/div. (680[2346]0, and CPU32) */ + M68K_FEATURE_LONG_MULDIV, + /* 64 bit mul/div. (680[2346]0, and CPU32) */ + M68K_FEATURE_QUAD_MULDIV, + /* Bcc with Long branches. (680[2346]0, and CPU32) */ + M68K_FEATURE_BCCL, + /* BFxxx Bit field insns. (680[2346]0) */ + M68K_FEATURE_BITFIELD, + /* fpu insn. (680[46]0) */ + M68K_FEATURE_FPU, + /* CAS/CAS2[WL] insns. (680[2346]0) */ + M68K_FEATURE_CAS, + /* BKPT insn. (680[12346]0, and CPU32) */ + M68K_FEATURE_BKPT, + /* RTD insn. (680[12346]0, and CPU32) */ + M68K_FEATURE_RTD, + /* CHK2 insn. (680[2346]0, and CPU32) */ + M68K_FEATURE_CHK2, + /* MOVEP insn. (680[01234]0, and CPU32) */ + M68K_FEATURE_MOVEP, + /* MOVEC insn. (from 68010) */ + M68K_FEATURE_MOVEC, }; =20 static inline int m68k_feature(CPUM68KState *env, int feature) --=20 2.29.2 From nobody Sat May 18 16:46:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1615501250; cv=none; d=zohomail.com; s=zohoarc; b=CDGJhZ/z0srE/yzNuS1d6zaBpZxm4BT3RzJyWEH7Mnv6IYjuoQV+xZOaidm5AsCl/pIqvjZqFtYB53pn7SQ2pXY+sQTg3E4xLDIbtvGQRFsdS8IiT4rFx8JLcwyVpnqRx3F1qx5+cSsnNPMvN34sFUFqlihqvFqRlpqPlaFntFg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615501250; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TbnTFshjIFgj5YmVr3kLMDoMDYUOqpq5IgXXL+oaJu4=; b=kUCuIJUpoXVYzEPCKuzNfCGiTXbRRI3t2doTdfVM+5ZEkXUIQDjugt/iZpsV0hHRreWwc/wq0JLAa0NeHHlhDFKG5w5cXuQ9tzxzFhxBx+OK+NiAB/T8MxaquevyY9CkY3904OYh2iHaCwazrpVfWujyhFxZUXknBB7lYlAesOY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615501250154911.7743028176769; Thu, 11 Mar 2021 14:20:50 -0800 (PST) Received: from localhost ([::1]:56080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKTfk-0005iC-QR for importer@patchew.org; Thu, 11 Mar 2021 17:20:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKTdg-0004It-T7 for qemu-devel@nongnu.org; Thu, 11 Mar 2021 17:18:40 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:34483) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKTda-00049u-J6 for qemu-devel@nongnu.org; Thu, 11 Mar 2021 17:18:40 -0500 Received: from localhost.localdomain ([82.142.6.26]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MCGag-1lSl5u2nUg-009N7j; Thu, 11 Mar 2021 23:18:32 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 4/4] target/m68k: add M68K_FEATURE_UNALIGNED_DATA feature Date: Thu, 11 Mar 2021 23:18:27 +0100 Message-Id: <20210311221827.2595898-5-laurent@vivier.eu> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210311221827.2595898-1-laurent@vivier.eu> References: <20210311221827.2595898-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:f79WPSjOAQ80XqI9L5dQ9ViAvJYgUdiNiwrIKakiqAoxbgzxg9h hoqJH9MRM7hQt4oonDaU5lyj8iXFo2/HFFbwL4akxliWvaFuGmFZxmLuLA1jVY97eqU6q79 1kAYuSBvqME4shk/kmln7X6WtV6X7XnnhXMxeNx4WNirhMyejH8U+YLsM3uLpO1iG0EIU43 pJ2ny4qV14c7dQAuhRF3g== X-UI-Out-Filterresults: notjunk:1;V03:K0:KHCm7O6N578=:bPVWizxVK1Aab9+7uy4ynR 0gNDEkzKLO7WPH0zEatVUOJALR16Y2r0kb8oxaiAVGSpfi0Q0QGfWmOOsV7VhqKd2m00JkN4l atCovNa+KpTPwmLHFvC59FBnHn9IQ7PQOp7kEPXjrqNFmDz1M9F79zkc2MZqwixkyuc8AcwhW AbgAtt/J1P9wFpcBtv99laW7Ek2c6hHZ1ue3mEIawwhbiEUjjO0woEe6i8vMeOqzz0bovJkhp Ua5wOsBsmS127mUm2htXmF1tF59LaLtfk3lvW4Y3M+dlpJAlTM+8gQ1UtM/pD9nwe/iKlt6ol xjMrb0kMaPRySz6DWgcixYlid9nzil/d9DsNS6oTNlBSpI9W4/o8wN/CzyuBQOYCFRJGuT1TO EtVnQje99oUrew82TkUlPb3z8WAXJagfs/xahGFTKdcKHjNeqFZphp4I55IPOGGH3nJIGfBUy 2QOnTCII3A== Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=212.227.126.133; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Mark Cave-Ayland , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland According to the M68040UM Appendix D the requirement for data accesses to be word aligned is only for the 68000, 68008 and 68010 CPUs. Later CPUs from t= he 68020 onwards will allow unaligned data accesses but at the cost of being l= ess efficient. Add a new M68K_FEATURE_UNALIGNED_DATA feature to specify that data accesses= are not required to be word aligned, and don't perform the alignment on the sta= ck pointer when taking an exception if this feature is not selected. This is required because the MacOS DAFB driver attempts to call an A-trap with a byte-aligned stack pointer during initialisation and without this the stack pointer is off by one when the A-trap returns. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Reviewed-by: Richard Henderson Message-Id: <20210308121155.2476-4-mark.cave-ayland@ilande.co.uk> Signed-off-by: Laurent Vivier --- target/m68k/cpu.h | 2 ++ target/m68k/cpu.c | 1 + target/m68k/op_helper.c | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index ce558e9b03e7..402c86c8769e 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -527,6 +527,8 @@ enum m68k_features { M68K_FEATURE_MOVEP, /* MOVEC insn. (from 68010) */ M68K_FEATURE_MOVEC, + /* Unaligned data accesses (680[2346]0) */ + M68K_FEATURE_UNALIGNED_DATA, }; =20 static inline int m68k_feature(CPUM68KState *env, int feature) diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 37d2ed9dc79c..a14874b4da28 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -161,6 +161,7 @@ static void m68020_cpu_initfn(Object *obj) m68k_set_feature(env, M68K_FEATURE_CAS); m68k_set_feature(env, M68K_FEATURE_CHK2); m68k_set_feature(env, M68K_FEATURE_MSP); + m68k_set_feature(env, M68K_FEATURE_UNALIGNED_DATA); } =20 /* diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index 5f981e5bf628..46ff81acc9f5 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -348,7 +348,10 @@ static void m68k_interrupt_all(CPUM68KState *env, int = is_hw) cpu_m68k_set_sr(env, sr); sp =3D env->aregs[7]; =20 - sp &=3D ~1; + if (!m68k_feature(env, M68K_FEATURE_UNALIGNED_DATA)) { + sp &=3D ~1; + } + if (cs->exception_index =3D=3D EXCP_ACCESS) { if (env->mmu.fault) { cpu_abort(cs, "DOUBLE MMU FAULT\n"); --=20 2.29.2