From nobody Mon Feb 9 05:19:53 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=buhman.org ARC-Seal: i=1; a=rsa-sha256; t=1712502491; cv=none; d=zohomail.com; s=zohoarc; b=MCMiJyuHiKACPxbNCIG+omsIUyy+PNaCS0I8cjvN8k6+lRw0TJZyDaZ+AJ79ck0LHaASNtoT+m1zJDnmxGK8DVXYIRN7oydZwTYbUC5XSmcroy8ia5o5rQXn1Mnaz2KY1v4QhB2doR8H/BrkyMyG6PJAcpAl3ulyWtNk3VvnP74= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712502491; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8CNDeXK0ztr9iRDTlFVH2zaWo90cTw52EAQSayqfQRg=; b=Zs51H/DJUjr5y1lPzSXc9p0nPljouLrKRT8C+eqzWwR57xCo66FkUrGVhRWWL4qHXLV4hRRFfTvIFbquQsrnpyMipl70G3ZfSgEsLA2O11Sn3HV4glG0D6U/+Z+sizoSEPIRV1ZvCihpA8tf99p9LKIn1sR8FAYuSbk9nBLa40E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1712502491353348.45712246895346; Sun, 7 Apr 2024 08:08:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtU6y-0004ZG-Fh; Sun, 07 Apr 2024 11:07:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtU6t-0004Z1-Un for qemu-devel@nongnu.org; Sun, 07 Apr 2024 11:07:08 -0400 Received: from wfout5-smtp.messagingengine.com ([64.147.123.148]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtU6r-0008J2-Fb for qemu-devel@nongnu.org; Sun, 07 Apr 2024 11:07:07 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.west.internal (Postfix) with ESMTP id E2AC71C0005B; Sun, 7 Apr 2024 11:06:59 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 07 Apr 2024 11:07:00 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 7 Apr 2024 11:06:55 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=buhman.org; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to; s=fm2; t=1712502419; x=1712588819; bh=8CNDeXK0ztr9iRDTlFVH2 zaWo90cTw52EAQSayqfQRg=; b=GB96m/CiQ2yr8aMS0+yEVhIXCi5GSnIIbQgol unz8yAZMf052+nsrbU3g+nitu6ODqm/9K2fRZM7hAO5doT+aWNa+5zZ4FzZDBl4U cREjy9RAbXJKHHH+5QSaoungZVoq9E6iIM0x1gEZOH8IuULNVNQbUWfQoKNCXeUP HlGt0XDqhBBGCXsMIS4X9EEh+DVBcxlvAjDvLrDHcuX3SOMFRO/SAjVdRJZT8xJr jhDM+Zwtv9NS5kxuzToFzt4RoD32+Wa0HIk3o5FH5+/YIgTni2C1mnjN3kHDN1mz FnreaDBzDxMNEewI7WMPavt2jgWYYVS9olRseWqB1Ycq7UK8Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1712502419; x=1712588819; bh=8CNDeXK0ztr9iRDTlFVH2zaWo90c Tw52EAQSayqfQRg=; b=GwJMTwenuq01Qjsi8LVALyk2e40ggQ4rJNi0Y/iBsP2s P3EDXNkdfUSz3PAtcvKTPdBjmaEhx0V+05DZs/ChYgvzXHShTWbicQcnpSH4qv5l OU6n75Rae/Wg2RCWXIDEmGALUjVBB5gRH3/qxhQulfImy1uOhUpcKXN0QsuAtWLr wxHJ3k5IeV0kCCUOxRkeRLa4z/n0ByMWZ4GeA3Dpboj0H0BeDZX0/FeBrJRtp6MN 2fd23HUhqfGfMqQLtU/aKOGcbyKmDq8dtpcucdL1nAJa10baTaq/+42JAupOmV4T lg1WFueTSzIb4ku6bFGfRT3iXkQlIIWnZzphEe79ew== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeggedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffoggfgsedtkeertd ertddtnecuhfhrohhmpegkrggtkhcuuehuhhhmrghnuceoiigrtghksegsuhhhmhgrnhdr ohhrgheqnecuggftrfgrthhtvghrnhepudetueelleefudffjeellefgffeihfeuheeutd efieefueeghfeltddvheduieeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghm pehmrghilhhfrhhomhepiigrtghksegsuhhhmhgrnhdrohhrgh X-ME-Proxy: Feedback-ID: i1541475f:Fastmail From: Zack Buhman To: qemu-devel@nongnu.org Cc: ysato@users.sourceforge.jp, Zack Buhman Subject: [PATCH] target/sh4: add missing CHECK_NOT_DELAY_SLOT Date: Sun, 7 Apr 2024 23:07:05 +0800 Message-ID: <20240407150705.5965-1-zack@buhman.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: pass client-ip=64.147.123.148; envelope-from=zack@buhman.org; helo=wfout5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @buhman.org) X-ZM-MESSAGEID: 1712502492593100001 Content-Type: text/plain; charset="utf-8" CHECK_NOT_DELAY_SLOT is correctly applied to the branch-related instructions, but not to the PC-relative mov* instructions. I verified the existence of an illegal slot exception on a SH7091 when any of these instructions are attempted inside a delay slot. This also matches the behavior described in the SH-4 ISA manual. Signed-off-by: Zack Buhman Reviewed-by: Richard Henderson Reviewed-by: Yoshinori Sato --- target/sh4/translate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/sh4/translate.c b/target/sh4/translate.c index 6643c14dde..ebb6c901bf 100644 --- a/target/sh4/translate.c +++ b/target/sh4/translate.c @@ -523,6 +523,7 @@ static void _decode_opc(DisasContext * ctx) tcg_gen_movi_i32(REG(B11_8), B7_0s); return; case 0x9000: /* mov.w @(disp,PC),Rn */ + CHECK_NOT_DELAY_SLOT { TCGv addr =3D tcg_constant_i32(ctx->base.pc_next + 4 + B7_0 * = 2); tcg_gen_qemu_ld_i32(REG(B11_8), addr, ctx->memidx, @@ -530,6 +531,7 @@ static void _decode_opc(DisasContext * ctx) } return; case 0xd000: /* mov.l @(disp,PC),Rn */ + CHECK_NOT_DELAY_SLOT { TCGv addr =3D tcg_constant_i32((ctx->base.pc_next + 4 + B7_0 *= 4) & ~3); tcg_gen_qemu_ld_i32(REG(B11_8), addr, ctx->memidx, @@ -1236,6 +1238,7 @@ static void _decode_opc(DisasContext * ctx) } return; case 0xc700: /* mova @(disp,PC),R0 */ + CHECK_NOT_DELAY_SLOT tcg_gen_movi_i32(REG(0), ((ctx->base.pc_next & 0xfffffffc) + 4 + B7_0 * 4) & ~3); return; --=20 2.41.0