From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Gf3uKGtLgmo5BysAWB0awg (envelope-from ) for ; Sun, 16 Aug 2026 19:44:43 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=embedded-brains.de header.i=@embedded-brains.de header.a=rsa-sha256 header.s=34EE5404-8E36-11F0-B577-2ECCAB4968F5 header.b=CGagDXTM; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A4D811E0A3; Sun, 16 Aug 2026 19:44:43 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 3FCEC1E09B for ; Sun, 16 Aug 2026 19:44:43 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7E7A64BA23EA for ; Sun, 16 Aug 2026 23:44:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E7A64BA23EA Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=embedded-brains.de header.i=@embedded-brains.de header.a=rsa-sha256 header.s=34EE5404-8E36-11F0-B577-2ECCAB4968F5 header.b=CGagDXTM Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) by sourceware.org (Postfix) with ESMTPS id DE8614BA2E05 for ; Sun, 16 Aug 2026 23:44:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DE8614BA2E05 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embedded-brains.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embedded-brains.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DE8614BA2E05 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=85.10.215.148 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786923848; cv=none; b=dJ8/6lxQrRGe/HEbPIhqYjp/kYbHsSbnZX9WE76DCJWiMsQ1SdQYI9rMytNaqoAiYZuMoxz96jhz4KgUMoEOWtIncqihh2tjoPYaeP7p2c6d5tMfv32Y1G0t6YoC6GT6mQYaz5zt7CNaP5/S1YYTU7PCVPKeI4K4lQ8hY5nKp60= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786923848; c=relaxed/simple; bh=SIUWuoQEGeGnYWY5l8t8yHexLKps77ZiU+l/t6YmfCQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RIIwfv3CdR/pV1KeX0cDb1/4G3ZNcX1kY1sufIUyRQU1/Op1q62fFTaQhQSp65ggCz/hjrsKjYJI1uxMG8RmD0EXbZjw5P4Cr+MEQyFCG+h/SPmR1Hm0jvF0yTtYjOl4vSs9JL3O0kUxIjAx0jQj2TkPBbfXm7QlI18PKiatn2Q= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=embedded-brains.de header.i=@embedded-brains.de header.a=rsa-sha256 header.s=34EE5404-8E36-11F0-B577-2ECCAB4968F5 header.b=CGagDXTM DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE8614BA2E05 Received: from sslproxy06.your-server.de ([78.46.172.3]) by dedi548.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1wvkWM-0009tt-1a for gdb-patches@sourceware.org; Mon, 17 Aug 2026 01:44:06 +0200 Received: from localhost ([127.0.0.1]) by sslproxy06.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wvkWM-000PKA-1h for gdb-patches@sourceware.org; Mon, 17 Aug 2026 01:44:06 +0200 Received: from localhost (localhost.eb.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 777124800A2 for ; Mon, 17 Aug 2026 01:44:06 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavis, port 10032) with ESMTP id BpNws8NBhoeY for ; Mon, 17 Aug 2026 01:44:06 +0200 (CEST) Received: from localhost (localhost.eb.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 133A248007A for ; Mon, 17 Aug 2026 01:44:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.embedded-brains.de 133A248007A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embedded-brains.de; s=34EE5404-8E36-11F0-B577-2ECCAB4968F5; t=1786923846; bh=FbXo0KmBeFO74VKSmkYG9khyUO0ki/pE0hABYEus1pM=; h=From:To:Date:Message-ID:MIME-Version; b=CGagDXTMks1yYJnQ1MJfSUo+pjroYosHGUdzG3GSTMrzfEB12jNVJ6z2caO+ARgxa 8BmThwTc7YHSOC4JY0+tJ2e2Fl9vRUOuPo/i29Fo/kPyUQ6ImQ14cdvXN+ja4Mnmsr OD6t9PrKSa2qE5ZAOWkhVRubjB2MxYtdy7WA4vqK/yU5ONcZCNa6rKWktRbQDDpHT4 /IZTFfDR3ZzlObDctKdor6/ig5Hixdh+G/QftKPCv9nqKJAUuEiDNy0D8rRlorqhgR aai2w5mternYAEtYFK3a7UEghpqzA8decZcKYlhk+g69hgDCZeZIep80UUrtWmlNFg ZcWCMEfpKjRMg== X-Virus-Scanned: amavis at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavis, port 10026) with ESMTP id xsfquOhphcdE for ; Mon, 17 Aug 2026 01:44:05 +0200 (CEST) Received: from zimbra.eb.localhost (unknown [10.10.171.14]) by mail.embedded-brains.de (Postfix) with ESMTPSA id 64E84480074 for ; Mon, 17 Aug 2026 01:44:05 +0200 (CEST) From: Sebastian Huber To: gdb-patches@sourceware.org Subject: [PATCH 2/4] sim/mips: Do not abort on a HI/LO hazard Date: Mon, 17 Aug 2026 01:43:54 +0200 Message-ID: <20260816234357.278358-3-sebastian.huber@embedded-brains.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260816234357.278358-1-sebastian.huber@embedded-brains.de> References: <20260816234357.278358-1-sebastian.huber@embedded-brains.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-DKIM-Status: pass [(embedded-brains.de) - 78.46.172.3] X-Virus-Scanned: Clear (ClamAV 1.4.3/28094/Sun Aug 16 08:26:19 2026) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org check_mf_hilo() calls sim_engine_abort() when a mfhi or mflo reads a value which the ISA leaves UNPREDICTABLE. The comment above the helper states the rule correctly: the result is UNPREDICTABLE, not an error. Reading an undefined value is not a fault, and the return value of the helper is discarded at both call sites, so the abort is its only effect. The abort halts the client and the run loop resumes it on the faulting instruction, which reads the same register again and aborts again. An operating system may save HI and LO on interrupt entry and restores them unchanged, so it reads them at an arbitrary instruction boundary where the last writer is whatever the interrupted program did. Every clock tick landing in multiply or divide heavy code then deadlocks it. Warn instead. Signed-off-by: Sebastian Huber --- sim/mips/mips.igen | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sim/mips/mips.igen b/sim/mips/mips.igen index 8203d19f8c4..fc2f81f85d0 100644 --- a/sim/mips/mips.igen +++ b/sim/mips/mips.igen @@ -411,12 +411,17 @@ && peer->mf.timestamp < peer->mt.timestamp)) { /* The peer has been written to since the last OP yet we have - not */ - sim_engine_abort (SD, CPU, CIA, "HILO: %s: MF at 0x%08lx following= OP at 0x%08lx corrupted by MT at 0x%08lx\n", - itable[MY_INDEX].name, - (long) CIA, - (long) history->op.cia, - (long) peer->mt.cia); + not. The ISA makes the result of this MF UNPREDICTABLE, it does not + make it an error. An operating system may save HI and LO + unconditionally on interrupt entry and restores them unchanged, so it + reads whatever the interrupted program left behind. Aborting the + simulation here deadlocks such a system, since the run loop resumes at + the faulting instruction and the MF is executed again. */ + sim_io_eprintf (SD, "HILO: %s: MF at 0x%08lx following OP at 0x%08= lx corrupted by MT at 0x%08lx\n", + itable[MY_INDEX].name, + (long) CIA, + (long) history->op.cia, + (long) peer->mt.cia); ok =3D 0; } history->mf.timestamp =3D time; --=20 2.51.0