From patchwork Mon May 17 18:14:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 12262893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38AB5C433ED for ; Mon, 17 May 2021 18:52:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DFC1561057 for ; Mon, 17 May 2021 18:52:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DFC1561057 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=vivier.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1liiMK-0002JL-TZ for qemu-devel@archiver.kernel.org; Mon, 17 May 2021 14:52:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lihm4-000707-FR for qemu-devel@nongnu.org; Mon, 17 May 2021 14:15:28 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:55945) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lihlZ-0004ZQ-Ci for qemu-devel@nongnu.org; Mon, 17 May 2021 14:15:28 -0400 Received: from quad ([82.142.31.78]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MKd92-1m3gYd1MjM-00KylB; Mon, 17 May 2021 20:14:55 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 56/59] linux-user/alpha: Share code for TARGET_NR_sigaction Date: Mon, 17 May 2021 20:14:21 +0200 Message-Id: <20210517181424.8093-57-laurent@vivier.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517181424.8093-1-laurent@vivier.eu> References: <20210517181424.8093-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:VRqOgVQyn2uZEI32R73D/tNDrEzGN9pMqKehuR8IzAu0OsRYqFb 7VMHyzT/fbly6sNo6FkT8U9NZ4jXNNs8YpJRJUdb6uUuYWKOyQ16zlqkijcbtbIObkHSGd/ avn2H01PK5kRI4Vy1lUlRK5NINvIg3EmfModtSO9MX8AB9i8bLT2UWVhvVUssQuj5x0TuSB LDVUp82LZ6Tuwdt8++XBQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:1cFfBAlHvyc=:ZgBUCzpPZ31GopnXCR2ORY 8oqSkW+JAUkoTBGbbP/cerxBgNwqXR958v6h/IY3CgVSqs65EhYQxET512mshWzukryjnz4ME GdsegIVsRfXrKS/Msp8wX0vMKcAb9dDwmpz1/OAiUJ+i3ovQ60L69xpUqnYsT9nIXe7d4ye99 oXDC4y8DeE9Mk6HJZZ4PA+3Fr8GdtUamoRuK+omxj54J1ssprC/UxOJ4mTSVqVy6Gm06PCe/6 j/v7BweVAf2BM3Z7frBcszof5RkNAGstihICofWEhITVqljhf1MOpDhMVfiD7C5XK5Uyw+3vu hDYNt5R5tYGEtTBS/zp4TT/QZtlH277HzxcMxa9Q72SbYYOXf0HQXUQOQLJpzgXRyoyYCTZAT 5ytn1Amo72tbu5HWI0u9yFINourzhbpylgEc9hPeZHiI/vMJY5fv3UX7YyDfLGl6PM9/dX7bX aSRBO/baH/Tc2z7k+1+ZT/zzUws7kv3dKXqGNpWEMUXXLaktLGVxBmqnDXl9WaUWhWsZEl52H 2HQVUexUWmU8EXDzMmSTJk= Received-SPF: none client-ip=212.227.126.187; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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: =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Laurent Vivier Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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ée Message-Id: <20210422230227.314751-7-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 23 +---------------------- linux-user/syscall_defs.h | 21 ++++++--------------- 2 files changed, 7 insertions(+), 37 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 4515f816b59b..2c5ced1570b5 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 = 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 = old_act->_sa_handler; - target_siginitset(&act.sa_mask, old_act->sa_mask); - act.sa_flags = old_act->sa_flags; - unlock_user_struct(old_act, arg2, 0); - pact = &act; - } - ret = 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 = oact._sa_handler; - old_act->sa_mask = oact.sa_mask.sig[0]; - old_act->sa_flags = 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; if (arg2) { diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 7a1d3b239c02..18b031a2f6a8 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_sigaction *act, #endif #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 -/* 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