From nobody Tue Feb 10 02:00:31 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1619132671; cv=none; d=zohomail.com; s=zohoarc; b=nwzeaQnSfG5YmppXoUk06voL+EY9/X3jv/PYdBfcztJ3qnfgu1lS62jNOQapWHM3SCZJCZy1fwpGLrS6r422PBZxTft/eJTKM62lxSnbnFkdCyqY/0pyRaGolW9ZQ8VJ1B0J90uu6/AWk74jjR+q1ClH7k9uXy3oEibjzcmRLdQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619132671; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9IBgpRlXRDcwQhpg7EYQ7Dn5EzD7vaEg5bq7L4WY5HM=; b=m6RO/olv3t1oXClBO9Na3XZUI/P1WGPpg11VBv1MEptn5dBUC5lUMcp4eCPxhSNpicrEsnanMB4U7PjLx8IMHkAhH+pTbFSRkKy37mdK8sH2z63e0jof5nHM+iHBdIeUfDp802i13tLJquxEyarKvtd+iMl1f1qhtMSndm99Dws= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1619132671892384.25321531761085; Thu, 22 Apr 2021 16:04:31 -0700 (PDT) Received: from localhost ([::1]:58466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lZiN4-0006qr-Mj for importer@patchew.org; Thu, 22 Apr 2021 19:04:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lZiLE-0005CN-W4 for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:37 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:40485) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lZiLD-0007pT-2g for qemu-devel@nongnu.org; Thu, 22 Apr 2021 19:02:36 -0400 Received: by mail-pl1-x633.google.com with SMTP id 20so20356068pll.7 for ; Thu, 22 Apr 2021 16:02:34 -0700 (PDT) Received: from localhost.localdomain ([71.212.131.83]) by smtp.gmail.com with ESMTPSA id z12sm2930605pfn.195.2021.04.22.16.02.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 16:02:33 -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=9IBgpRlXRDcwQhpg7EYQ7Dn5EzD7vaEg5bq7L4WY5HM=; b=avWb8ynRA7J49Tc/sUJZVMIW1LAdjHBf/5vjzQRzWX7xOKc08cIafzUFQtskoiV3B0 IScMgUuQhJaROSWth3xdwKMPX7O3L4d7sMESOi1j5tx0EtnT7Vk10UOIMmIuanaLMYNl d42DVyqFyj0wd6z8QmteiBpXOTE4olQm6hFYJdT99XkBFlLONCN/dybefuUM4DBhdUrw NwSB9TpgIQLN8aiIEjecvoGDqGW6KBw3VkhXUI6UcWF+i8/xpawayEKW5mC+OUVeG4sk BDBwluwNAiBcESviTIa0AbcXFGSnuWXpZRcnEbxV/4VhGa3dklaW3HIJAWZ9SSSdCRqY VzRg== 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=9IBgpRlXRDcwQhpg7EYQ7Dn5EzD7vaEg5bq7L4WY5HM=; b=FLjGcUIc4AIhSIZMmjTlROJblYshNC8JownBZpZFiFo8YO057LwHUNhpWnic+84WRV livBDsoXBfL8/bWn/rZ1J18kRBQCyUtsKGkxo8CBcT7N9tHk5IovCg8DrVCZ7P78XSr5 Gb2KXRF2tfDQg9I8yrUDzGoAYeRli29XT0D1crHa4jl6f8Z3ziw9B+COYSR1DTUBmXnE 14UOKLBPFGFI86VHuGpyPewKf4RNQ//1gqUfQB3WzGyG4hHy/C1we+VxY+5fDhaRmuZY /fM2LsF5z2wVDEAHeYLosZP1k92rDvo8rvA0PtO9S6R8llNHLKQYF5/1K1FINPQQCkoA fs4Q== X-Gm-Message-State: AOAM533dyc1QBCArvxW8vV5IbHjX1owz5wy3RYvptC4WSQnJ8IaEdalf 7Yux8qgOrhHg2PI/Kwl/RoeGvf/X8ABPPQ== X-Google-Smtp-Source: ABdhPJyKfKQX/W5aXPaw1CrVqCIv4VgYY+mPZMCr/0VfpIVYh+e73MxlJlG4mu7WP6j3X0IOFImGpQ== X-Received: by 2002:a17:902:a38e:b029:eb:3963:5aee with SMTP id x14-20020a170902a38eb02900eb39635aeemr1142615pla.78.1619132553313; Thu, 22 Apr 2021 16:02:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 6/7] linux-user/alpha: Share code for TARGET_NR_sigaction Date: Thu, 22 Apr 2021 16:02:26 -0700 Message-Id: <20210422230227.314751-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210422230227.314751-1-richard.henderson@linaro.org> References: <20210422230227.314751-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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: alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" There's no longer a difference between the alpha code and the generic code. There is a type difference in target_old_sigaction.sa_flags, which can be resolved with a very much smaller ifdef, which allows us to finish sharing the target_sigaction definition. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- linux-user/syscall_defs.h | 21 ++++++--------------- linux-user/syscall.c | 23 +---------------------- 2 files changed, 7 insertions(+), 37 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 7a1d3b239c..18b031a2f6 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -501,21 +501,12 @@ int do_sigaction(int sig, const struct target_sigacti= on *act, #endif =20 #if defined(TARGET_ALPHA) -struct target_old_sigaction { - abi_ulong _sa_handler; - abi_ulong sa_mask; - int32_t sa_flags; -}; +typedef int32_t target_old_sa_flags; +#else +typedef abi_ulong target_old_sa_flags; +#endif =20 -/* This is the struct used inside the kernel. The ka_restorer - field comes from the 5th argument to sys_rt_sigaction. */ -struct target_sigaction { - abi_ulong _sa_handler; - abi_ulong sa_flags; - target_sigset_t sa_mask; - abi_ulong ka_restorer; -}; -#elif defined(TARGET_MIPS) +#if defined(TARGET_MIPS) struct target_sigaction { uint32_t sa_flags; #if defined(TARGET_ABI_MIPSN32) @@ -533,7 +524,7 @@ struct target_sigaction { struct target_old_sigaction { abi_ulong _sa_handler; abi_ulong sa_mask; - abi_ulong sa_flags; + target_old_sa_flags sa_flags; #ifdef TARGET_ARCH_HAS_SA_RESTORER abi_ulong sa_restorer; #endif diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 216ee4ca47..9bcd485423 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8980,28 +8980,7 @@ static abi_long do_syscall1(void *cpu_env, int num, = abi_long arg1, #ifdef TARGET_NR_sigaction case TARGET_NR_sigaction: { -#if defined(TARGET_ALPHA) - struct target_sigaction act, oact, *pact =3D 0; - struct target_old_sigaction *old_act; - if (arg2) { - if (!lock_user_struct(VERIFY_READ, old_act, arg2, 1)) - return -TARGET_EFAULT; - act._sa_handler =3D old_act->_sa_handler; - target_siginitset(&act.sa_mask, old_act->sa_mask); - act.sa_flags =3D old_act->sa_flags; - unlock_user_struct(old_act, arg2, 0); - pact =3D &act; - } - ret =3D get_errno(do_sigaction(arg1, pact, &oact, 0)); - if (!is_error(ret) && arg3) { - if (!lock_user_struct(VERIFY_WRITE, old_act, arg3, 0)) - return -TARGET_EFAULT; - old_act->_sa_handler =3D oact._sa_handler; - old_act->sa_mask =3D oact.sa_mask.sig[0]; - old_act->sa_flags =3D oact.sa_flags; - unlock_user_struct(old_act, arg3, 1); - } -#elif defined(TARGET_MIPS) +#if defined(TARGET_MIPS) struct target_sigaction act, oact, *pact, *old_act; =20 if (arg2) { --=20 2.25.1