From patchwork Fri Feb 7 15:31:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862994 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp385848wrt; Fri, 7 Feb 2025 07:38:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVYVRvK3u4osc7hsZzAcai1lsxzxSr5vnAn2Fkx6MZBGXdbud3ddjSrrui0wOTyEWUqRevMsg==@linaro.org X-Google-Smtp-Source: AGHT+IHst61yYHfmgLFWroxuvrvES9DMnL/jATxUgYY5YjYIimlkzmHsbM9bOdb/6e9At19geikA X-Received: by 2002:a05:620a:800e:b0:7b7:5d6:3976 with SMTP id af79cd13be357-7c047caf1b4mr626793985a.58.1738942727932; Fri, 07 Feb 2025 07:38:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942727; cv=none; d=google.com; s=arc-20240605; b=T+M9YOTx0KJ56nKs5Lm0QQFao4L3e8dUCZ3IE8YO2MTtJASSpnSX/wiBSoVEeQ93pc eyGKJ3p+uhNcRuhrDbL8rA3SWAJDUhUYw4HhB8tQH7kIzzRnTQNhvE98GTYMSCaplO3U i/aJuZyf7nfu8zqZ7MDzigLy38xnaAhspW+SX9bLYP1/LB6Ffi+QQoPSOstwVh0CswgH O6fAAxElO3JhbXxd3u9moZyDZFjtLHL1uEJwNGyyt/vPI7ltBzJkS3x+pFvoJCAPNWsj jc3Oz0W124kgH/MkwkAjdj6kyErBya0y7KVycIurXxnFysTHvbS6rpZHEcm2tsbeBdiZ UHjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=ss1s/z8UDnfCDTK92VTNTdO4MGHnAPeMCWUHdvvh61s=; fh=Jdg4fLQw/+vV+BD6NiVJYsZoanjBKb4fl4V8sUUe9bg=; b=LGJNYyBvKiSN2nIV2uUeBh+UzpU0/C6SIwnVnDAkts68Iv2txxVir3fzssKalF7pma hZPzP7lVRXxvSFezd52HOcXMbQ1DvYZ37s2TaM93lQ46sVouPqKga5d61+whvcXuIOlb woUZJB+tJJH96fXQ3jBfq+owUkPcTSNRiqVKpyzku0pyrfgcPx1DPs1Y+e4oA1dLTeIn S6C37l2MI40tO2b7IKj6iptTTsJBjq4wPmjlk8sHZbpu+GsMCYw0eqBCspe3jFi26m57 O+/SpOiAK9tSOcNSsB1Oybf+BluxMkmFsVSkWhQsLjCB+HDBo9TJgDb7801marBMBf5l VqMA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nNMZDgnh; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7c041ee6210si359759385a.611.2025.02.07.07.38.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:38:47 -0800 (PST) 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=nNMZDgnh; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQOJ-0006xq-Ps; Fri, 07 Feb 2025 10:35:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tgQKY-0008GI-Kf for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:52 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQKH-00042v-Ns for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:44 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-38dc660b56cso1323101f8f.0 for ; Fri, 07 Feb 2025 07:31:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942283; x=1739547083; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ss1s/z8UDnfCDTK92VTNTdO4MGHnAPeMCWUHdvvh61s=; b=nNMZDgnhuQajNYVVq558zMpeT6wnXeS/yqwKxgtG3MYBrNDn/sG1+zozdI/ayyzUFZ EuEq7Qh7stYMgyk2KcVByC1KGPQjadhB1QGzSSt1bxtDZynBJ6Kj8gLdjS+9pNdynlhh yXEL6t84aWrRmdo9bqUk3FDvO4/oB4kURd7Ub4iB0Yv8uONtp4fqzhZT/p2mu76epJPV EPyKGmRhTmeKMs58iVLx79nUZy/U746UIRSTnwwOvOOWy6W0AdJ4Wk2G2i6H5en0fjqG +pwj58/5H/sUFieGkcGTk8VqsqB344Ivai4FYGxYTpzQ39wg6CYQnK/ucLrhDAmsqaXq 9dqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942283; x=1739547083; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ss1s/z8UDnfCDTK92VTNTdO4MGHnAPeMCWUHdvvh61s=; b=pAc3X3xfj4OdYACegLvv/zaSyyPJ2++G5iCNYwWFhGeHnlveOzwOnqqyxTjvZm8jit Dmm5d5Cq8acIHeyHj9KEn61DGMqdLOU3zP5c0KPE+y1sE1DK9RrEr2vIAHjQeMdPWXx1 SYYTEK8d7BPbKFX1RGRu9StFUMMu8EPtvv7HzO37l9U5yOfMfAB/e8WGK1G374gsnPK4 WULos21230hsPd6wpO8FElyWzKgvwhp8hYx4lv9r28L4/M60QBcCixDMp1Kc82C7fqWt PcyUECOvjwDjVjcavqG/oe0icj+N7haptkAoVaAp7T6OC8L7FGiPvM1oh07DMVsdNg7d KBMw== X-Gm-Message-State: AOJu0Yw10FV1rSBAYh0M+Wp6f/gcGqZ2ng2Fg0g73EkRlsg6FGJPD7Ul 19oLjVAqBw7sYZO+ZSi4o5b3iKIhlNspmY3UdGU2NDrqQm0VaSn9dt/EkRX7EjI= X-Gm-Gg: ASbGncun5ClBfbmVdyoZ/zQd2WP/pOc5Eo21yPNxA48PrPFgkv/YGi6MOqBKcym9sjp wC9VfCCVNqKIIY8qmFpNDLdqmQ7XQre3utZaPV/IQzt9PFg5QOn9kWDXAebQjnYrGzcQXJkL5Pa Y2jQwZdkfEeU3j49ZcF3/vHC1hambPscb8F2cj03uCQn3Op+NQWrFbx96py8Vymbpwrsy2ih69q qGTQYN0hmn84yWG6kc1ruRsKu3aQ164MxV0wdyPVsAb7dGpXfqTi7UZ1UF9fEBOQnTgV9AHyEoW B7U/5ndtCoQPAMFrqQ== X-Received: by 2002:a5d:584b:0:b0:38b:e32a:109f with SMTP id ffacd0b85a97d-38dc8dbfc57mr2993423f8f.12.1738942283500; Fri, 07 Feb 2025 07:31:23 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab779832909sm246283066b.49.2025.02.07.07.31.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:18 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 7F319609FC; Fri, 7 Feb 2025 15:31:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org, Ilya Leoshkevich , Richard Henderson Subject: [PATCH v2 12/17] user: Introduce user/signal.h Date: Fri, 7 Feb 2025 15:31:07 +0000 Message-Id: <20250207153112.3939799-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42c.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich gdbstub needs target_to_host_signal(), so move its declaration to a public header. Reviewed-by: Richard Henderson Reviewed-by: Warner Losh Signed-off-by: Ilya Leoshkevich Message-Id: <20250117001542.8290-4-iii@linux.ibm.com> Signed-off-by: Alex Bennée --- bsd-user/signal-common.h | 1 - include/user/signal.h | 23 +++++++++++++++++++++++ linux-user/signal-common.h | 1 - bsd-user/signal.c | 1 + linux-user/signal.c | 1 + linux-user/syscall.c | 1 + 6 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 include/user/signal.h diff --git a/bsd-user/signal-common.h b/bsd-user/signal-common.h index 77d7c7a78b..4e634e04a3 100644 --- a/bsd-user/signal-common.h +++ b/bsd-user/signal-common.h @@ -42,7 +42,6 @@ void process_pending_signals(CPUArchState *env); void queue_signal(CPUArchState *env, int sig, int si_type, target_siginfo_t *info); void signal_init(void); -int target_to_host_signal(int sig); void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); /* diff --git a/include/user/signal.h b/include/user/signal.h new file mode 100644 index 0000000000..19b6b9e5dd --- /dev/null +++ b/include/user/signal.h @@ -0,0 +1,23 @@ +/* + * Signal-related declarations. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef USER_SIGNAL_H +#define USER_SIGNAL_H + +#ifndef CONFIG_USER_ONLY +#error Cannot include this header from system emulation +#endif + +/** + * target_to_host_signal: + * @sig: target signal. + * + * On success, return the host signal between 0 (inclusive) and NSIG + * (exclusive) corresponding to the target signal @sig. Return any other value + * on failure. + */ +int target_to_host_signal(int sig); + +#endif diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index 8584d9ecc2..196d2406f8 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -61,7 +61,6 @@ void queue_signal(CPUArchState *env, int sig, int si_type, target_siginfo_t *info); void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info); void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo); -int target_to_host_signal(int sig); int host_to_target_signal(int sig); long do_sigreturn(CPUArchState *env); long do_rt_sigreturn(CPUArchState *env); diff --git a/bsd-user/signal.c b/bsd-user/signal.c index b4e1458237..8c51f6ce65 100644 --- a/bsd-user/signal.c +++ b/bsd-user/signal.c @@ -24,6 +24,7 @@ #include "user/cpu_loop.h" #include "exec/page-protection.h" #include "user/page-protection.h" +#include "user/signal.h" #include "user/tswap-target.h" #include "gdbstub/user.h" #include "signal-common.h" diff --git a/linux-user/signal.c b/linux-user/signal.c index 087c4d270e..bffbef235c 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -36,6 +36,7 @@ #include "user/cpu_loop.h" #include "user/page-protection.h" #include "user/safe-syscall.h" +#include "user/signal.h" #include "tcg/tcg.h" /* target_siginfo_t must fit in gdbstub's siginfo save area. */ diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 6ee02383da..90afaa4426 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -138,6 +138,7 @@ #include "user-mmap.h" #include "user/page-protection.h" #include "user/safe-syscall.h" +#include "user/signal.h" #include "qemu/guest-random.h" #include "qemu/selfmap.h" #include "user/syscall-trace.h"