From patchwork Wed Sep 15 17:49:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 512224 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp422296jao; Wed, 15 Sep 2021 10:51:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwi2ZDDgJIg1Z6i0mfcGAEU8VFxRXDayjRv5s+L6Iz903SnIGKkws7x01QbOAC+FM3Y6lHK X-Received: by 2002:ac8:584f:: with SMTP id h15mr1118133qth.6.1631728267298; Wed, 15 Sep 2021 10:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631728267; cv=none; d=google.com; s=arc-20160816; b=EgMYSTstL7TIddHJZt/jJO4AdXZqrVCYvV25Gd0tRT0YmzK79l1lIHqiVa1P5YfYn6 UvjIAVenf6UHCRLSpMr+Cu1Oi0jHnIehu2rXTwH+isTiW1HNZLXuHWAzCXMCiJO0RV2s KFH4pZxminG4p1C6J6L4k/RLAVU6n1uJIlZsJlEFTUlaInk2KBVaRHeNGwXsbBXhwO93 slFuUlfuIFROs+04GYA7jm0H90hgCPZ6nCWDK1Z+zy14t4KesN+cnNhkSoVw8ien5Coz 5g7mcwnvw6BJZBK0krsNXLaVlEyD1C6gGtS86PxDiaiKFEYXCl6BGHL98nqcQaHehyW+ 5vIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature; bh=bcayDksC/Oq9jBwFrtjuESC91JhSZUwPZau7KUsWGbg=; b=LdRPg77BuuVHGvJ4KBi7R70dZ/isgcyah3jufVIxr0B64jaaROkXf6Lj6Ta2giAn9H asTJzNpsAFF6PZKtgphAKL0O3RsbWlxGiTqhrGIlyDiwKD+aN8szRpWJaZ9MaiHt4yU0 FVAvNw4XNUj0MbW85oIRM3ybJ21ebcHZZDTavVyga3Q16fiFm+0zzi23lQCx22PBd3Hn pmeTWgAhZVBSA81AF59C7zU/PCKmB0S8inZpSrWKeKeJhSnEK3S+i9bTNDgC7ZRZF8eE oMRqT34KCfHMqlKQMz5+Rj1hfwh5Qafii8fDs07IuQOC5OHljTUeD65u/5uU6bZHZ4Qi xkgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dsLawO+Z; 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=fail (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 k23si236879qtq.212.2021.09.15.10.51.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Sep 2021 10:51:07 -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=fail header.i=@linaro.org header.s=google header.b=dsLawO+Z; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQZ3q-0000u2-Rq for patch@linaro.org; Wed, 15 Sep 2021 13:51:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQZ2i-0000tk-EJ for qemu-devel@nongnu.org; Wed, 15 Sep 2021 13:49:56 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:41633) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQZ2g-00037M-Qr for qemu-devel@nongnu.org; Wed, 15 Sep 2021 13:49:56 -0400 Received: by mail-pl1-x634.google.com with SMTP id v2so2096595plp.8 for ; Wed, 15 Sep 2021 10:49:54 -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:mime-version :content-transfer-encoding; bh=bcayDksC/Oq9jBwFrtjuESC91JhSZUwPZau7KUsWGbg=; b=dsLawO+Z/dWd9HNw51fZtkWuMpHnjx9m5y9aUORsrQqKIR4WZr9JOGNifsXuputiqX 0uLTRUnUC/SEYnq0eW60rhPpv0GGJJCd1J9niZ+STNYNCIDTj6Gqc29WvVGR5ls226Ds 0GhGiqzWOoKvHGK4DWuPXglNXp57/EWXPajwD23fBYHI5nESOEYpiXxGSBK90W4vrVEO a287+M7cav/5K7VLsJCVbpCjvicpm8rUKG1SiptfiP/7zo20oMxGpLjyTxhbwHtRVO5J 2xEI0yd+FykScma/kccQj3U3ddHEh7EhTdOZ3v59EDwpPUbZiNTDdFK0ykyY1TJP3SwG AGPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=bcayDksC/Oq9jBwFrtjuESC91JhSZUwPZau7KUsWGbg=; b=rJsFKjKaaT/jZpDjy/vMIRFm/OAY2KirmE1fbQjRTiKNZrDMGu4854TN6/JJqZwEZW P1nxkvdElyQXwo+q50CvGSB5GYdkyklNbt1a3KUtr0AVb+WhRYDJ28iGhutjy+a72hOC 3pZiuHbtjAjz+UQ+c+FwcVInsVjXXMnyKOX1Ckb7aFP21wjflezsh4oraxWYNz8ka2TL Ebijt0jI+iz+uqvdPO6ov3Nk06vyUgNLtoBHBCMnnb0BQXHoFHKoEVTZh/HryqeWOGiI c+66q9mTGndriypYLEBQwlQANUyDdJuPxwAWCAp/xJ1Rhi/dO70O8sVWQazDJ4a8s0VW zTNA== X-Gm-Message-State: AOAM530WVlW9nbQcs5EzXWDF3r2HRKvhFWLXVwj6+RTETcjkfwwr6AC7 BukGis7p9uEXz9vMhcLMpIt3GsVKeHXrHg== X-Received: by 2002:a17:90a:a791:: with SMTP id f17mr1023428pjq.225.1631728193105; Wed, 15 Sep 2021 10:49:53 -0700 (PDT) Received: from localhost.localdomain ([71.212.134.125]) by smtp.gmail.com with ESMTPSA id g4sm311667pjt.56.2021.09.15.10.49.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 10:49:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 0/2] linux-user/nios2: trap and kuser fixes Date: Wed, 15 Sep 2021 10:49:49 -0700 Message-Id: <20210915174951.1852266-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, crwulff@gmail.com, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Based-on: 20210813131809.28655-1-peter.maydell@linaro.org ("linux-user: Clean up siginfo_t handling for arm, aarch64") ... for force_sig_fault(). Emulation of EXCP_TRAP was really wrong, in that we were using the contents of R1 when we really wanted the trap immediate. Emulation of the kuser page was wrong, in that the first word contains the version, and must be readable. The easiest way to fix this is to map real data, but then we have to come up with some replacement for __kuser_cmpxchg, and the easiest way to do that is to steal an unused trap number. Both of these stand in the way of cleaning up SIGSEGV, which is how the kuser page is currently implemented. I built a nios2-elf binutils and wrote a couple of asm smoke tests for this. So, golden! r~ Richard Henderson (2): linux-user/nios2: Properly emulate EXCP_TRAP linux-user/nios2: Map a real kuser page target/nios2/cpu.h | 5 ++- linux-user/elfload.c | 35 +++++++++++++++ linux-user/nios2/cpu_loop.c | 85 ++++++++++++++++++++----------------- target/nios2/translate.c | 26 +++++++----- 4 files changed, 99 insertions(+), 52 deletions(-) -- 2.25.1