From patchwork Tue Apr 9 19:35:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 787252 Delivered-To: patch@linaro.org Received: by 2002:adf:fdd2:0:b0:346:15ad:a2a with SMTP id i18csp384327wrs; Tue, 9 Apr 2024 12:40:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWJiZ/pTduiZcRwjMCaQCX+cZQgaZ4fvCKTYSLDW3YhWSQCm1n1jakvz38XAR4ZvRVyHI9ZwHTvuSGK5E3ap9wZ X-Google-Smtp-Source: AGHT+IFVIIsArVbLtwd3hJc6fwD/UP7XIrn0n9KxevbS634j2ajRC4RR5iLXNet4hKIRe306yUfv X-Received: by 2002:a25:a565:0:b0:dcc:a446:551 with SMTP id h92-20020a25a565000000b00dcca4460551mr747705ybi.52.1712691600253; Tue, 09 Apr 2024 12:40:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712691600; cv=none; d=google.com; s=arc-20160816; b=OjH4BC5DJ/+j3wOTMMABKxdF/ttokM6PP5x8ehgjKc0oQkGOYHvVxcV3y74mTtUijI X5gbGH7eI9CWOiU7pPKzZtPDa8PDR+E77yjMEHCT/6+qxmH5Xkmmq0qR8Fcj6KFkJk2C VXQSFq2V6XYTbD1rOM3yU2rDeHvj13uav+kU5WPumO+Tqi0LSLuKrMQPhbxaUPRlNOkY DG+e0U4jUUf9GFcBOR2ARmHLhfu5z1dB+73F2NU6EantFC3xMmobGO7DpfdwdmdcJX0/ fFlVRIN+XwyStl7JQuKV7Wl9Zk7X1n5Fx//CW4J8jQAGvs6k9od8tjr4D+zlVR7oc2Ar jF+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dcOly76/DhggOn/gIOyjbUFt0Yi/pTy/JSDCl4K3h8A=; fh=K7lFbwafzDFe9RlZVtFGWQUxhy0uw4Mr/E9DDf1LH8k=; b=bw8yJw2+S42WR4jnij3vnTeFgY748cHwwBs6+2GZTO2CFQ7/Qt0pjfKZwn6J3zk3FL sNjAdvrw/6yRfE0+C+Td+QSBBCyfLlc2lmjW/drbwvB4N/6axk83S2YP1oxIxC6RjCM7 5jzRrBNXM5oKa6+zemr71HNbQz02MN9LxOWLvF/GIqHg4k2IKgJTszNw/WcgBCjV/Hp6 oh3Xtbq1l1HK33EykL5Gw8YndGqfxsb7qyXFfDGP9CA7a0kxl6/loFb/m60RoN2635y9 0ZRZVKV+fl6stuzwskRjj6Eh1hJlpplpxl1IAMACqGZ5yiZ0WT4Ove02L0EYE/EBsOV7 C46g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jwqxI3/4"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u12-20020a05620a454c00b0078d572d4811si8962680qkp.443.2024.04.09.12.40.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2024 12:40:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jwqxI3/4"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruHGY-0000aR-QF; Tue, 09 Apr 2024 15:36:22 -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 1ruHGX-0000a3-Qk for qemu-devel@nongnu.org; Tue, 09 Apr 2024 15:36:21 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruHGW-0004eG-5O for qemu-devel@nongnu.org; Tue, 09 Apr 2024 15:36:21 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1e220e40998so38065785ad.1 for ; Tue, 09 Apr 2024 12:36:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712691379; x=1713296179; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dcOly76/DhggOn/gIOyjbUFt0Yi/pTy/JSDCl4K3h8A=; b=jwqxI3/4Zfon+kR8l7DTN8rsjOlg6srLqxNmOC/f2Dg0C38qoU1GjeD8gpruqlqyyi SYZ6jPr676/iLBdm+aTEVU3B7UcJnBW3tUBcTGjaRu/Qpfepnm3DAD/iHRXoGExC5tuT Ap0qYqhKPd5SithiuFnEy651oG1gzzefygP2wugdrFwN5eHOZIudV3kYQj9rk3XJET1X b3I7josc37xF6XXnLGVGlzrOrF3+hsphZY9ST0FDoBk9CZslvt3iU3Twag9/tGxYDPXw und2zIZ7a2iw+++0j9qR7xYBj3saKfM5DrZWGqYdXADS5xY7O9nkLDbTuaNbSKz2mXY0 WLow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712691379; x=1713296179; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dcOly76/DhggOn/gIOyjbUFt0Yi/pTy/JSDCl4K3h8A=; b=Fl6CKWKFrX/Nq252By6fOveyn+J51+fCzlUekwTzpgFfcTTZ90YrbESlBmvLyIhobs CHbjBIaz+GLGwTS7v1S1BPomxfrdRDGqwx10+5I5znSK/ov6SszwamcAlVC3R5YyTY/1 D8fkHbJEAyBiey93l4phbvgb1UbQpRYMe+MqbInEPhfu9sQP6gJ/5J3X6qY/9m4rlWS/ 90AtJxwXWuSXU8EfgbCHmmEdAiKPS6WEQQpAbF0GQhyF2oIHjHvJtuu4QWDs+5LimjI4 5WTbuWKi54NorVHomhEVtAes63Jt7h8sbdG1v68ti9iIGyjWYOh7Z0R8+I3MEnjlzazL iZYQ== X-Gm-Message-State: AOJu0Yz8PcnwUN2zjpEonQoEKVR9GycZt8VM1B0YohuUtYfSbezZ/G2S 5sqXn6+NGLFdiwBg1IKJ1s8ZM51IIflkGYL7uvHGUArO6rtMmnPkUkj5UuJyadZR6Pm4L/xa0+U m X-Received: by 2002:a17:902:e80f:b0:1e3:e0a2:ccc3 with SMTP id u15-20020a170902e80f00b001e3e0a2ccc3mr875818plg.30.1712691378795; Tue, 09 Apr 2024 12:36:18 -0700 (PDT) Received: from stoup.. (098-147-007-212.res.spectrum.com. [98.147.7.212]) by smtp.gmail.com with ESMTPSA id c17-20020a170902d49100b001e1071cf0bbsm6065843plg.302.2024.04.09.12.36.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 12:36:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Zack Buhman , Yoshinori Sato Subject: [PULL v2 09/20] target/sh4: add missing CHECK_NOT_DELAY_SLOT Date: Tue, 9 Apr 2024 09:35:52 -1000 Message-Id: <20240409193603.1703216-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240409193603.1703216-1-richard.henderson@linaro.org> References: <20240409193603.1703216-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Zack Buhman 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 Message-Id: <20240407150705.5965-1-zack@buhman.org> Signed-off-by: Richard Henderson Reviewd-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 = 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 = 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;