From nobody Mon Feb 9 19:52:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486616066695697.1025478401837; Wed, 8 Feb 2017 20:54:26 -0800 (PST) Received: from localhost ([::1]:35510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cbgkT-0003Cb-7F for importer@patchew.org; Wed, 08 Feb 2017 23:54:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37985) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cbgiT-00025Z-FY for qemu-devel@nongnu.org; Wed, 08 Feb 2017 23:52:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cbgiP-0007jN-60 for qemu-devel@nongnu.org; Wed, 08 Feb 2017 23:52:21 -0500 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:33234) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cbgiP-0007jI-1C; Wed, 08 Feb 2017 23:52:17 -0500 Received: by mail-pg0-x244.google.com with SMTP id 194so16792487pgd.0; Wed, 08 Feb 2017 20:52:16 -0800 (PST) Received: from bigtime.home ([1.128.80.123]) by smtp.gmail.com with ESMTPSA id b75sm24202832pfb.90.2017.02.08.20.52.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Feb 2017 20:52:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=PS1yzg2qNpHqbKcSDEtwXDj1vGrkbgQT/QK32kQ9bxs=; b=TNPCzXW9YRarpSIIJqx0T1Znl76aCOTEk6bdrFgGT6yI//BWQhG5fScwKaozMM7vTh 2I+2tys6EqJHY6GuqWrPsSOMo3EaAdJiJJshyW4NMWTWJiRNUQHmkFIxmMYeBaFONzNa RGZz89G+gQOPH3kV5XGxHndOIa6bpx8yduZgSTMXLs13zl2ZWWPoKGkNdLFRbfheGCYE IggmLTyJi8y5vdWphYIjKcrB5H10UpfzXs+M13PX7/YHgKtQsq/6nZXLNPexDecIesXO v7x/yE9TCnCSNEx7KGghX0BRUQ3Nc67GLWZ+JssJp/a5Wa9EKtCNVp0xgnKDtRcCFSFA B29g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=PS1yzg2qNpHqbKcSDEtwXDj1vGrkbgQT/QK32kQ9bxs=; b=K74RCv2uLOqPwQwGvq660icEhvnFWH9cQaTkt5k/jTAzLvNmup04WxsWvNZtUwnq2F AsCwD1b2YTRyMO6OHdGGbNXEJlzsTcsTBqKL5NirPR5ZL0Yuw/bmf03dYGUX09UIItbP Ym5aDOUyZ9ji65T0ecvSiDYOpMnYHrH4zecptmuFXVLcukZQu1LjIP/l8FaDqY6fBJ1x VQz+h+yAWEqJpINMzaYbbGj+6u/sDwR9+2ZCeaSTqenNl06zCkzok5D4nwAThJ8wB2PW E7tUQYEfDG6RRCsuV9So5ycpmUs/6nlFZiVSbiq5TNsAknclP6UXkkreL5hnPzE/Z70G wzNw== X-Gm-Message-State: AMke39mFq9sZJbnyNxnA/ecbmAq1H9KSdigU3EMZurFN7qvGODq/pQgxkHIAyuVMdaYDTw== X-Received: by 10.98.139.22 with SMTP id j22mr1461275pfe.115.1486615935879; Wed, 08 Feb 2017 20:52:15 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 Feb 2017 20:51:36 -0800 Message-Id: <20170209045154.16868-5-rth@twiddle.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170209045154.16868-1-rth@twiddle.net> References: <20170209045154.16868-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::244 Subject: [Qemu-devel] [PATCH 04/22] target/openrisc: Fix exception handling status registers 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: qemu-trivial@nongnu.org, shorne@gmail.com, openrisc@lists.librecores.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Stafford Horne I am working on testing instruction emulation patches for the linux kernel. During testing I found these 2 issues: - sets DSX (delay slot exception) but never clears it - EEAR for illegal insns should point to the bad exception (as per openrisc spec) but its not This patch fixes these two issues by clearing the DSX flag when not in a delay slot and by setting EEAR to exception PC when handling illegal instruction exceptions. After this patch the openrisc kernel with latest patches boots great on qemu and instruction emulation works. Cc: qemu-trivial@nongnu.org Cc: openrisc@lists.librecores.org Signed-off-by: Stafford Horne Message-Id: <20170113220028.29687-1-shorne@gmail.com> Signed-off-by: Richard Henderson --- target/openrisc/interrupt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target/openrisc/interrupt.c b/target/openrisc/interrupt.c index e43fc84..a243eb2 100644 --- a/target/openrisc/interrupt.c +++ b/target/openrisc/interrupt.c @@ -38,10 +38,17 @@ void openrisc_cpu_do_interrupt(CPUState *cs) env->flags &=3D ~D_FLAG; env->sr |=3D SR_DSX; env->epcr -=3D 4; + } else { + env->sr &=3D ~SR_DSX; } if (cs->exception_index =3D=3D EXCP_SYSCALL) { env->epcr +=3D 4; } + /* When we have an illegal instruction the error effective address + shall be set to the illegal instruction address. */ + if (cs->exception_index =3D=3D EXCP_ILLEGAL) { + env->eear =3D env->pc; + } =20 /* For machine-state changed between user-mode and supervisor mode, we need flush TLB when we enter&exit EXCP. */ --=20 2.9.3