From patchwork Tue Oct 16 22:47:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 10644309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 87AAD17D2 for ; Tue, 16 Oct 2018 22:49:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79E292A7A0 for ; Tue, 16 Oct 2018 22:49:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D3A32A7A4; Tue, 16 Oct 2018 22:49:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 173DB2A7A0 for ; Tue, 16 Oct 2018 22:49:20 +0000 (UTC) Received: from localhost ([::1]:60490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCY9P-0003Bb-FD for patchwork-qemu-devel@patchwork.kernel.org; Tue, 16 Oct 2018 18:49:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCY8J-0002bJ-7u for qemu-devel@nongnu.org; Tue, 16 Oct 2018 18:48:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCY8E-0000JC-LQ for qemu-devel@nongnu.org; Tue, 16 Oct 2018 18:48:11 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:38217) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gCY8E-0000GU-DS for qemu-devel@nongnu.org; Tue, 16 Oct 2018 18:48:06 -0400 Received: by mail-pg1-x542.google.com with SMTP id f8-v6so11531750pgq.5 for ; Tue, 16 Oct 2018 15:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YVIzaqGqcSek/W9m146no0EL7hPxw0pzBJjehFtdc8I=; b=NDd+qMyTR6cnCEAZ8Lzt2RFi6Yu0pYd+anbx7xQWu4l8P2GPVAkViinNoGGVyvRC9C k4ZUgBjX6J/6yUoHPvoG0cVOYZzsTGB4zpwhW07wudMHfB4qbh7pBFbMNIXunC8OH3E0 3J50mZslXXKwS7+Vrzt6QS9W8zya78W4v4gkE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YVIzaqGqcSek/W9m146no0EL7hPxw0pzBJjehFtdc8I=; b=Kcm9o5SzGNiC+HOQuf/Ixz8hlqmy+Ji3Hi4RyqfXLyfBsC+bLEvS0BWtsmHshsrzFP W9iQBHgnisXN3Jv8E96ZYtf38u2BK+8/djoZPQRozwGlFoS7+r+F2eVy593fNlQuTtQh gRHrXJbeyO7VcOGVXDU9YTdNW+lUeYNhZcqOUS0aAToiqOUpbpUKC2Ipivoylf4KgcaW 07J9mbf2Z03fspl5FfCl4XwQQParbTYDVtuGUiNQ8azRZ25M2HqyPc03yzhK9Ruo9k6S YNCyce2sZtWCC+6MGHtFpfYHLdnVFf2XJhemd+OcubOZIDP3EQGg2EnlCAMWWa4bZCW6 2Zwg== X-Gm-Message-State: ABuFfoiUAnlEONvO379QYvaE9sHBmMC8L5Kbl954K4ZzMs/kS9zq7clF 8oy5iQGhyHcNjwtYHtU6hpHrii1JOEw= X-Google-Smtp-Source: ACcGV63fE+qULiHXTbayCppElt0TAcBERgzkbzl4eRttiUXqPAPI4eOXK6rC6pDotWjER0qS7qjsYQ== X-Received: by 2002:a62:3a84:: with SMTP id v4-v6mr23740255pfj.118.1539730083079; Tue, 16 Oct 2018 15:48:03 -0700 (PDT) Received: from cloudburst.twiddle.net (174-21-9-133.tukw.qwest.net. [174.21.9.133]) by smtp.gmail.com with ESMTPSA id p17-v6sm29357481pfk.186.2018.10.16.15.48.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Oct 2018 15:48:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 16 Oct 2018 15:47:59 -0700 Message-Id: <20181016224759.3158-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181016224759.3158-1-richard.henderson@linaro.org> References: <20181016224759.3158-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PULL 1/1] target/hppa: Raise exception 26 on emulated hardware 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: peter.maydell@linaro.org, Helge Deller Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Helge Deller On PCXS chips (PA7000, pa 1.1a), trap #18 is raised on memory faults, while all later chips (>= PA7100) generate either trap #26, #27 or #28 (depending on the fault type). Since the current qemu emulation emulates a B160L machine (with a PA7300LC PCX-L2 chip, we should raise trap #26 (EXCP_DMAR) instead of #18 (EXCP_DMP) on access faults by the Linux kernel to page zero. With the patch we now get the correct output (I tested against real hardware): Kernel Fault: Code=26 (Data memory access rights trap) instead of: Kernel Fault: Code=18 (Data memory protection/unaligned access trap) Signed-off-by: Helge Deller Message-Id: <20181007205153.GA30270@ls3530.fritz.box> Signed-off-by: Richard Henderson --- target/hppa/mem_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index ab160c2a74..aecf3075f6 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -137,7 +137,8 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, if (unlikely(!(prot & type))) { /* The access isn't allowed -- Inst/Data Memory Protection Fault. */ - ret = (type & PAGE_EXEC ? EXCP_IMP : EXCP_DMP); + ret = (type & PAGE_EXEC ? EXCP_IMP : + prot & PAGE_READ ? EXCP_DMP : EXCP_DMAR); goto egress; }