From patchwork Sun Aug 22 03:55:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501405 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1060224jab; Sat, 21 Aug 2021 21:01:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOkbVfktfaiYQ+Qpa7P978ahpV+V+SGN+XY9tL1y0JWLwLl5nb5zFv4LLPViBIat1nW6lG X-Received: by 2002:a02:7755:: with SMTP id g82mr23827993jac.45.1629604880605; Sat, 21 Aug 2021 21:01:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629604880; cv=none; d=google.com; s=arc-20160816; b=Gq9pYJZxJCqfADR3GLpsdpiVP59gxPJs16IR6bsOMW2ZqIu5nYEVoRJmA1YhsmLrMr EuA3w4DanbR7w93JjUD6jwagc5w8FCNmwdmFbrr6BDFyxU2HzPsEHfh+TRy7UvigU4EY fXqqmnj7cpEjFq3nUfFeX1ryrv0Sps5ZpY3eWhIJd4AFjEfpbMbkwQPWlrllihOudnj+ SQnzAzI7J8DQ27iyYLxlC4qyxb5a/dMTN3HBawj1MFLfxipGiTpqIoOxpy+wwc3gfYLA yWJ703HTWfuT7Iu03gtFfctVxj609tI5FQ9o9JDvWT+bmb0DFoUkzjlzqdH0+2IVST3h zZXA== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=y84dl2fafIHncS6Y/RS/Ptnx8qYyRhYz7fzOuToVOxw=; b=QoJjHbPrLB8zgX+Y2NuXkZkNi0malO7v6/5nJEC8Gf1df+vVG01zkXMzy++kBwNEae QH+Z6Z0/4jzq+Il44K+iJ27eycpphWuFN6qn/FjxcNA6jyMVs60dcoGuuNCA+rqSjl7O 1erQMjT3ciWTiK3jzPAZ6JaGY86AXIKNQM5ymg6hftnLLDnjc6LgV3b6egZfeLz+TSEE W50fG8s7cW2AdgqvyJQ9Cjv42bfO79b3m8/KJy6E4DQQXbEJlWPr+c2Tt29b5D7k4I8i zfjyq8g6OjxJW1Jh2sjrZ9uUXDPWKsLYXkb3OCORUTsnsdu/B3vcUWuv8kZR+qECa4WP 2lCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Bt3LwJ6v; 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 k21si11615577jaq.73.2021.08.21.21.01.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:01:20 -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=Bt3LwJ6v; 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]:54800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHefg-0002Rh-2D for patch@linaro.org; Sun, 22 Aug 2021 00:01:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaU-0007u7-It for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:59 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:34431) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaR-0000lk-P8 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:55:58 -0400 Received: by mail-pl1-x635.google.com with SMTP id j2so3795438pll.1 for ; Sat, 21 Aug 2021 20:55:55 -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 :mime-version:content-transfer-encoding; bh=y84dl2fafIHncS6Y/RS/Ptnx8qYyRhYz7fzOuToVOxw=; b=Bt3LwJ6vyI56XOGZ5kAZh2DV4rbLYWS1GM6Dxt9Qq4Qe5Qi/H0a6JzsmrxKq7zbJPm igHRtzx7uu2Jg26fbuaGoa/+5fa0AQ8oI76c3cY1xut2+LYhXHK/kFM2AtT3bCbhfAdr CseML3Ib2yMhb9fuM5z//5jQ0dHqnXAcgpZoxOBAzMXV090TGLwyMdMIjhrj/Vp45HWB v23gCdM+zRaEaAtlmyD2Kn+mN4yoAPJHUmXo0rqC6Mmf6wDVEwQEZXSX2QT5SLjJiN/d eP8dvwvl7IcFDcSN+z1qdf3sluPfy5hNX3w3vUC1o5iVGZXuEjFBtSo88pemyclK3IdU e93w== 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:mime-version:content-transfer-encoding; bh=y84dl2fafIHncS6Y/RS/Ptnx8qYyRhYz7fzOuToVOxw=; b=dICZ1iQ2ImgiFkSAFaZ4ue1FRj30gj7McFAhG4n1ygdhMSRTOK3mE7KK4ZkLQ9azmn x6Bk27Wd9GcuISjJIck7TpQqhVHVmeFZWYFgYOsgu4DjP3Acizcndj7hVU9CSu4TGXTk 6o/wrp76z+UeQEzLwptBhciOyV5pInPO5ti5VsRnmTSyLRH06JeXeHu5kLhAlluGAV/6 0jnqeCy0eme62l5aQFEoPi2xQWwFoBu4hrLi50dzEJWvUvm3aPkmylorOEMpl6VQDFyF wzcJrNkq/v5GH7BWIRP58pvVhTprRt4UGdfU+8LBaE9lGxSO24sGCKXfOYOIAeKhudeG CjnQ== X-Gm-Message-State: AOAM530ahV3zi6rySGuXx7vjtpl8lmq7H56pR3aFmj0S8IX9dkP9TAxk EcKkI9oCdU7Lytpjnpf2McaiEHPsqg2y2A== X-Received: by 2002:a17:902:a710:b029:12b:9b9f:c461 with SMTP id w16-20020a170902a710b029012b9b9fc461mr22639734plq.59.1629604554442; Sat, 21 Aug 2021 20:55:54 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 24/30] linux-user/openrisc: Use force_sig_fault, force_sigsegv_for_addr Date: Sat, 21 Aug 2021 20:55:31 -0700 Message-Id: <20210822035537.283193-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210822035537.283193-1-richard.henderson@linaro.org> References: <20210822035537.283193-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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use the new functions instead of setting up a target_siginfo_t and calling queue_signal. Signed-off-by: Richard Henderson --- linux-user/openrisc/cpu_loop.c | 37 +++++++++------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) -- 2.25.1 diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c index b33fa77718..d2632ce6a3 100644 --- a/linux-user/openrisc/cpu_loop.c +++ b/linux-user/openrisc/cpu_loop.c @@ -21,13 +21,14 @@ #include "qemu-common.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" + void cpu_loop(CPUOpenRISCState *env) { CPUState *cs = env_cpu(env); int trapnr; abi_long ret; - target_siginfo_t info; for (;;) { cpu_exec_start(cs); @@ -54,42 +55,24 @@ void cpu_loop(CPUOpenRISCState *env) break; case EXCP_DPF: case EXCP_IPF: + force_sigsegv_for_addr(env->eear); + break; case EXCP_RANGE: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_MAPERR; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + case EXCP_FPE: + /* ??? The kernel vectors both of these to unhandled_exception. */ + force_sig(TARGET_SIGSEGV); break; case EXCP_ALIGN: - info.si_signo = TARGET_SIGBUS; - info.si_errno = 0; - info.si_code = TARGET_BUS_ADRALN; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGBUS, TARGET_BUS_ADRALN, env->eear); break; case EXCP_ILLEGAL: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = TARGET_ILL_ILLOPC; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); - break; - case EXCP_FPE: - info.si_signo = TARGET_SIGFPE; - info.si_errno = 0; - info.si_code = 0; - info._sifields._sigfault._addr = env->pc; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, env->pc); break; case EXCP_INTERRUPT: /* We processed the pending cpu work above. */ break; case EXCP_DEBUG: - info.si_signo = TARGET_SIGTRAP; - info.si_errno = 0; - info.si_code = TARGET_TRAP_BRKPT; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc); break; case EXCP_ATOMIC: cpu_exec_step_atomic(cs);