From patchwork Sun Aug 22 03:55:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 501421 Delivered-To: patch@linaro.org Received: by 2002:a02:6f15:0:0:0:0:0 with SMTP id x21csp1067487jab; Sat, 21 Aug 2021 21:17:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyd18nNw+xnY8EXNDk+5P8WmIpePnkmgyZn3Q34ZJeBV2+My0ZKyMB3SGSd4IAhPbI0/JYB X-Received: by 2002:a25:7806:: with SMTP id t6mr35816660ybc.132.1629605859805; Sat, 21 Aug 2021 21:17:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629605859; cv=none; d=google.com; s=arc-20160816; b=b9AjY6I+QXjnmEokyG726kudD1Rr1jIJDd3JkLdAHfQyi/FeGfrKwLGif/1erxHorm KBt49VI3yaYg2gjXXfEZWRlYT8VqCMjJEJcj58BnGvuPcbnizMDYHALgg/d0zJozazGP 4j8x8ClauOYpGNoAwgPHfjFVsDcycYwKEKSnPrDr0Oiu/6FcA5ct8xffskf51ym4zLW2 RViXbYAEzyunKuxISFrEOGOr2HKnaI5sThI2OMw0Mc9fAmORFOcqEET0r1eisGbk1pRI vP8m/vpq7YI8KIrEkBCdj5F5ysTqLixYVBkRx5SHRWZx4ewdbd/KX1+Bm/w4OcaL+J5A Ogow== 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=OTd7GpVNfJwdpnYm/hpk5WQx19kQn+kD8ce7/pdQayk=; b=VPMj3feCGZvoWop3Fd06h25v1NkprsKxK0EWUe0oNQmUBT7aSjrbFtLj73pdG8sJtA zJwz54gV3rR9uW7qGZpW5Mla3gZ1G4W+OKtkSrszB96bGsuCaMRdGOMbcK1agycgk3Zn BwhyGIoUpB9kIn3oHIkbu6sNV77nCwmn1gbcBe1D7Pvgr327sRUDqaWjPJq1ZxCwBALx Me0QqWJ0se4tOGjFXHX3erpvQK+xfK8Au5S9vtZlwdk2tm79y9oPGbhLHXgfvl2CaR8I 2dyvxHts8SCuGMnpn4ual1fQ2RqFO8KL21ZnMo8CONw8iSuahv30ehqKhEHSDAEVbm2m KrqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Yw88Rh1d; 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 q129si10994576ybc.242.2021.08.21.21.17.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 21 Aug 2021 21:17:39 -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=Yw88Rh1d; 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]:38762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHevT-0004Le-9Z for patch@linaro.org; Sun, 22 Aug 2021 00:17:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHeaX-0007vR-42 for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:56:02 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:36712) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mHeaV-0000pW-Kh for qemu-devel@nongnu.org; Sat, 21 Aug 2021 23:56:00 -0400 Received: by mail-pg1-x535.google.com with SMTP id t1so13339285pgv.3 for ; Sat, 21 Aug 2021 20:55:59 -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=OTd7GpVNfJwdpnYm/hpk5WQx19kQn+kD8ce7/pdQayk=; b=Yw88Rh1dIc1WlEzidobtk/THqqQiOTwl6pdI2/Hfhmf6sVvIlJS2w8NeeUOmewmWnI iqRQ14ZziL96vLYn8T1pBHHtbd8ZbTuUykza+iPvG6k6DJzNjdCUkLZmWnlNPxNwltXm K5GcWrBdLSOZus93KGMn7erJFdJuVWFq7GFsgewvZe4euVVw1gtzLqwZ60bsXhBkIStX 081YEB/u6WJHauTMzUgN6nfhhHZvQAu1Tg0Q6o1xic/8EWdaDQKie0aIgwNAdED1GdGD a90Jq5tiZFpCjO4At0wRzOFJtegplsa00xxMdI3NkDZm8KWXdEUXt+VKkjx0JVrn0rou XZQg== 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=OTd7GpVNfJwdpnYm/hpk5WQx19kQn+kD8ce7/pdQayk=; b=NTAHyL2h3IYFjjOEOM4OIhThLos2Kmdr3s8C8Ug00JynBQnPrgxAFbB2/nKhrY2Ywx FmGLtGIUTBiqIzd2+Hat606NASMNs7NyM3tBCJ3wF6Q38vucqv0mMzbnUayzzhaNoLGT yNkwRdilbnivq4ltDdbhdPJYEqlbdEv89xQFUmxhbqfLlFWv3P/Fy1Lb9vEVKJHY88HP uZG6ID/T0DBeRudic5bO7qoQ3fv3cuEnMvj/uYNiAXi5+bjdt6P3n03iiuDbM024KGfP UdP/jQ342BFXKVeK7ZFbddSSYFtCB7J0xGvDBRnDiyabk+/+FDB8gp43pH7bNd31Yhkk EFzg== X-Gm-Message-State: AOAM5305yuWKh5aAADJDLs6+QdXoqjhUD1mVaULZVxYD83nISXgw5kyJ Zhm7mwhFoO8ylJw/QkNEpzwXCjF3CYyCwg== X-Received: by 2002:a63:1a46:: with SMTP id a6mr25749522pgm.226.1629604558362; Sat, 21 Aug 2021 20:55:58 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id x12sm11560533pfu.21.2021.08.21.20.55.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 20:55:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 30/30] linux-user/xtensa: Use force_sig_fault, force_sigsegv_for_addr Date: Sat, 21 Aug 2021 20:55:37 -0700 Message-Id: <20210822035537.283193-31-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::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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/xtensa/cpu_loop.c | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) -- 2.25.1 Reviewed-by: Peter Maydell diff --git a/linux-user/xtensa/cpu_loop.c b/linux-user/xtensa/cpu_loop.c index 64831c9199..869a8501b8 100644 --- a/linux-user/xtensa/cpu_loop.c +++ b/linux-user/xtensa/cpu_loop.c @@ -20,6 +20,8 @@ #include "qemu/osdep.h" #include "qemu.h" #include "cpu_loop-common.h" +#include "signal-common.h" + static void xtensa_rfw(CPUXtensaState *env) { @@ -124,7 +126,6 @@ static void xtensa_underflow12(CPUXtensaState *env) void cpu_loop(CPUXtensaState *env) { CPUState *cs = env_cpu(env); - target_siginfo_t info; abi_ulong ret; int trapnr; @@ -161,14 +162,12 @@ void cpu_loop(CPUXtensaState *env) case EXC_USER: switch (env->sregs[EXCCAUSE]) { case ILLEGAL_INSTRUCTION_CAUSE: + force_sig_fault(TARGET_SIGILL, TARGET_ILL_ILLOPC, + env->sregs[EPC1]); + break; case PRIVILEGED_CAUSE: - info.si_signo = TARGET_SIGILL; - info.si_errno = 0; - info.si_code = - env->sregs[EXCCAUSE] == ILLEGAL_INSTRUCTION_CAUSE ? - TARGET_ILL_ILLOPC : TARGET_ILL_PRVOPC; - info._sifields._sigfault._addr = env->sregs[EPC1]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGILL, TARGET_ILL_PRVOPC, + env->sregs[EPC1]); break; case SYSCALL_CAUSE: @@ -217,20 +216,13 @@ void cpu_loop(CPUXtensaState *env) break; case INTEGER_DIVIDE_BY_ZERO_CAUSE: - info.si_signo = TARGET_SIGFPE; - info.si_errno = 0; - info.si_code = TARGET_FPE_INTDIV; - info._sifields._sigfault._addr = env->sregs[EPC1]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sig_fault(TARGET_SIGFPE, TARGET_FPE_INTDIV, + env->sregs[EPC1]); break; case LOAD_PROHIBITED_CAUSE: case STORE_PROHIBITED_CAUSE: - info.si_signo = TARGET_SIGSEGV; - info.si_errno = 0; - info.si_code = TARGET_SEGV_ACCERR; - info._sifields._sigfault._addr = env->sregs[EXCVADDR]; - queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info); + force_sigsegv_for_addr(env->sregs[EXCVADDR]); break; default: @@ -239,10 +231,8 @@ void cpu_loop(CPUXtensaState *env) } 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->sregs[EPC1]); break; case EXC_DEBUG: default: