From patchwork Sun May 19 20:37:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164548 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4808448ili; Sun, 19 May 2019 14:22:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+6vpY6oWStzlRkBhczGLIgPVir+snOSj7NEaOD4t/GBMf8EVkmIL8/L+b4kTUeSGEjdol X-Received: by 2002:a17:906:371b:: with SMTP id d27mr38694824ejc.80.1558300956719; Sun, 19 May 2019 14:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558300956; cv=none; d=google.com; s=arc-20160816; b=sOOVfzaRh4Lj9wtGCAKJ2p4UTeNx/ggWGlxHx9oukuudqU3etdMv9hNYyZzUiBjRCQ iQHu3CYTb0AGFiJUnvYzvqVGm8MTmFfMPNCMi1rfh98J/y/+TMCcFCq/ZyID+iLNf0uF 6XXsg03K5QU2k8MB65OL+6TLJhvXVwNXPUkkRrKmKMbjgVJLKQB1e1tl3ng3YazaykVu KGy1em6Ny8wstr58MX+FapH8BidqKRx9k6GPKIz7bKVVgpqtvqVkNxFv0M5BGRpnOpZR 6UAFcpxqgP1I4SUCcVCCKBQVaPCG+XoYiPDbHrs9/tPQFD1uaXDWhH+PuTzUvcdqon1/ cuTg== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=76+mjrN9dH89H5/Svkq5qWa063W+g+MfoJgRAxm+Ooc=; b=Ql40HBMARL288+yER+QpX1fvtZnxvPn7u7ZJzk6pnOi5MxDg5GJyu438FZf7/xFgfl MlZ9b7iMO3zi0VI5LdpAsAXym3Msfxyy8MbL6lTLOpz/L5dR/M6TO8PZN5Z5rBJaYPfa PmqxNYHpg00vweKeIO1s5HZt+saYAdkHGsBCwDR5rYUIPDUHw5Nn6b6Top0G1KEgmImi zLQ3rRFLzpJuC4AsXwVCqkdheghLEt9kT98c4Tph/s5Gik+Eyyk/kFteRay1ByiW6vdG 37nZk6ThYHiIjNJBLIE9UujRpEp0n1ZHhLYx2ED0OzI+1z6NMjVP0ZEajFpkpB5fsz1G nftg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Edxlms5o; 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=fail (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 e22si5083119eda.365.2019.05.19.14.22.36 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 19 May 2019 14:22:36 -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=fail header.i=@linaro.org header.s=google header.b=Edxlms5o; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:53772 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSTGN-0008I9-Hv for patch@linaro.org; Sun, 19 May 2019 17:22:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSZy-0003vO-C3 for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSSZx-0004q8-3g for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:46 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:35287) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSSZw-0004pR-T1 for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:45 -0400 Received: by mail-pg1-x544.google.com with SMTP id t1so4322877pgc.2 for ; Sun, 19 May 2019 13:38:44 -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; bh=76+mjrN9dH89H5/Svkq5qWa063W+g+MfoJgRAxm+Ooc=; b=Edxlms5o54PZXlEF5kPdWDXQ4iTGf95k5hqzTjWT+BcEys4GQDYYRXX6bDuMS/HkUZ rW08V+EwLSK6Z+sh1Fe05z1zYUErudvuhAAB4ecpPuMou4bY98ZbO0oIjjvNDtE7lqyP boenIk/yvjt379MUEK6C3N0uBsy1hgAcUMIUbJxjFfTtQMqG/pZsaamaFoi/btMTjY4V NYDQxmIonrxBBgLe79B9vTnhP5j1yssVtfS3JyvBGOSHpYXJbnqrzywyRivvJjb9Azhr 7ofNQP9aVjO5ksoXar31E0uj9jpvG4/cpDjaiSb8FF0Xe12daTPvnJkG9+R114+e+Lq9 0Zow== 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; bh=76+mjrN9dH89H5/Svkq5qWa063W+g+MfoJgRAxm+Ooc=; b=Kw7AkimgssylYhsfuIdqpQZbC1Hu2CqeoJCoyhcsjOJckc4qLurFzxonuZ3Ck3CYl3 fH9BWN6qhebIMIgP6izLNCsblp/07zw+6Pnf507ocKMpwNkovy6QYxg0alwHPLHhEpAv wsRL8RsUOWW1rPCQVDdIDh4086eSWwBTIOkyApDXd6iO+XSngcyqFDbOmCswQiquJQe1 bnEApqpd3ymbDSwhdRey6T9Y3gfb6oYF6vryjWt9z5nfLAJPiaMR9JXzaHNQ0ChvNuhP uHFhdGACwLmWnomyyIFTQA/OS4y9V9MCd+GcBUQhlJ4monkBnh/FgJWXEkgRsvUX50Iz H1Vg== X-Gm-Message-State: APjAAAUGDH9Telk523lYL4nv8kI/NODrrDsmYUQzCEKHt6ZXP2OaywOc K1SpEmTESaQMcbgTgFs+tjiiX6FRXdY= X-Received: by 2002:a63:d150:: with SMTP id c16mr71008417pgj.439.1558298323712; Sun, 19 May 2019 13:38:43 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id i7sm11397448pfo.19.2019.05.19.13.38.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 May 2019 13:38:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 13:37:12 -0700 Message-Id: <20190519203726.20729-61-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190519203726.20729-1-richard.henderson@linaro.org> References: <20190519203726.20729-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 Subject: [Qemu-devel] [PATCH v7 60/74] linux-user: Split out sigsuspend, rt_sigsuspend X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/syscall-defs.h | 6 +++++ linux-user/syscall-sig.inc.c | 51 ++++++++++++++++++++++++++++++++++++ linux-user/syscall.c | 42 ++--------------------------- linux-user/strace.list | 6 ----- 4 files changed, 59 insertions(+), 46 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h index 83a69246d0..2b930f5599 100644 --- a/linux-user/syscall-defs.h +++ b/linux-user/syscall-defs.h @@ -196,6 +196,7 @@ SYSCALL_DEF(rt_sigaction, ARG_SIGNAL, ARG_PTR, ARG_PTR, ARG_DEC); #endif SYSCALL_DEF(rt_sigpending, ARG_PTR, ARG_DEC); SYSCALL_DEF(rt_sigprocmask, ARG_SIGPROCMASKHOW, ARG_PTR, ARG_PTR, ARG_DEC); +SYSCALL_DEF(rt_sigsuspend, ARG_PTR, ARG_DEC); #if !defined(SYSCALL_TABLE) || defined(TARGET_NR_semctl) SYSCALL_DEF(semctl, ARG_DEC, ARG_DEC, ARG_DEC, ARG_HEX); #endif @@ -232,6 +233,11 @@ SYSCALL_DEF(sigprocmask, ARG_SIGPROCMASKHOW, ARG_HEX); #elif defined(TARGET_NR_sigprocmask) SYSCALL_DEF(sigprocmask, ARG_SIGPROCMASKHOW, ARG_PTR, ARG_PTR); #endif +#if defined(TARGET_ALPHA) +SYSCALL_DEF(sigsuspend, ARG_HEX); +#elif defined(TARGET_NR_sigsuspend) +SYSCALL_DEF(sigsuspend, ARG_PTR); +#endif #ifdef TARGET_NR_sgetmask SYSCALL_DEF(sgetmask); #endif diff --git a/linux-user/syscall-sig.inc.c b/linux-user/syscall-sig.inc.c index fe717a5121..23ea14e2a6 100644 --- a/linux-user/syscall-sig.inc.c +++ b/linux-user/syscall-sig.inc.c @@ -191,6 +191,30 @@ SYSCALL_IMPL(rt_sigprocmask) return ret; } +SYSCALL_IMPL(rt_sigsuspend) +{ + CPUState *cpu = ENV_GET_CPU(cpu_env); + TaskState *ts = cpu->opaque; + abi_long ret; + void *p; + + if (arg2 != sizeof(target_sigset_t)) { + return -TARGET_EINVAL; + } + p = lock_user(VERIFY_READ, arg1, sizeof(target_sigset_t), 1); + if (!p) { + return -TARGET_EFAULT; + } + target_to_host_sigset(&ts->sigsuspend_mask, p); + unlock_user(p, arg1, 0); + + ret = get_errno(safe_rt_sigsuspend(&ts->sigsuspend_mask, SIGSET_T_SIZE)); + if (ret != -TARGET_ERESTARTSYS) { + ts->in_sigsuspend = 1; + } + return ret; +} + #ifdef TARGET_NR_sigaction SYSCALL_IMPL(sigaction) { @@ -380,6 +404,33 @@ SYSCALL_IMPL(sigprocmask) } #endif +#ifdef TARGET_NR_sigsuspend +SYSCALL_IMPL(sigsuspend) +{ + CPUState *cpu = ENV_GET_CPU(cpu_env); + TaskState *ts = cpu->opaque; + abi_long ret; + +#if defined(TARGET_ALPHA) + abi_ulong mask = arg1; + target_to_host_old_sigset(&ts->sigsuspend_mask, &mask); +#else + void *p = lock_user(VERIFY_READ, arg1, sizeof(target_sigset_t), 1); + if (!p) { + return -TARGET_EFAULT; + } + target_to_host_old_sigset(&ts->sigsuspend_mask, p); + unlock_user(p, arg1, 0); +#endif + + ret = get_errno(safe_rt_sigsuspend(&ts->sigsuspend_mask, SIGSET_T_SIZE)); + if (ret != -TARGET_ERESTARTSYS) { + ts->in_sigsuspend = 1; + } + return ret; +} +#endif + #ifdef TARGET_NR_sgetmask SYSCALL_IMPL(sgetmask) { diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 7dda237c95..00f4ba8753 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4227,7 +4227,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, abi_long arg5, abi_long arg6, abi_long arg7, abi_long arg8) { - CPUState *cpu = ENV_GET_CPU(cpu_env); abi_long ret; #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) \ || defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64) \ @@ -4241,45 +4240,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, void *p; switch(num) { -#ifdef TARGET_NR_sigsuspend - case TARGET_NR_sigsuspend: - { - TaskState *ts = cpu->opaque; -#if defined(TARGET_ALPHA) - abi_ulong mask = arg1; - target_to_host_old_sigset(&ts->sigsuspend_mask, &mask); -#else - if (!(p = lock_user(VERIFY_READ, arg1, sizeof(target_sigset_t), 1))) - return -TARGET_EFAULT; - target_to_host_old_sigset(&ts->sigsuspend_mask, p); - unlock_user(p, arg1, 0); -#endif - ret = get_errno(safe_rt_sigsuspend(&ts->sigsuspend_mask, - SIGSET_T_SIZE)); - if (ret != -TARGET_ERESTARTSYS) { - ts->in_sigsuspend = 1; - } - } - return ret; -#endif - case TARGET_NR_rt_sigsuspend: - { - TaskState *ts = cpu->opaque; - - if (arg2 != sizeof(target_sigset_t)) { - return -TARGET_EINVAL; - } - if (!(p = lock_user(VERIFY_READ, arg1, sizeof(target_sigset_t), 1))) - return -TARGET_EFAULT; - target_to_host_sigset(&ts->sigsuspend_mask, p); - unlock_user(p, arg1, 0); - ret = get_errno(safe_rt_sigsuspend(&ts->sigsuspend_mask, - SIGSET_T_SIZE)); - if (ret != -TARGET_ERESTARTSYS) { - ts->in_sigsuspend = 1; - } - } - return ret; case TARGET_NR_rt_sigtimedwait: { sigset_t set; @@ -6659,6 +6619,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, return do_set_thread_area(cpu_env, arg1); #elif defined(TARGET_M68K) { + CPUState *cpu = ENV_GET_CPU(cpu_env); TaskState *ts = cpu->opaque; ts->tp_value = arg1; return 0; @@ -6673,6 +6634,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, return do_get_thread_area(cpu_env, arg1); #elif defined(TARGET_M68K) { + CPUState *cpu = ENV_GET_CPU(cpu_env); TaskState *ts = cpu->opaque; return ts->tp_value; } diff --git a/linux-user/strace.list b/linux-user/strace.list index 978e47bf0e..26df8b25cd 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -932,9 +932,6 @@ #ifdef TARGET_NR_rt_sigreturn { TARGET_NR_rt_sigreturn, "rt_sigreturn" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_rt_sigsuspend -{ TARGET_NR_rt_sigsuspend, "rt_sigsuspend" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_rt_sigtimedwait { TARGET_NR_rt_sigtimedwait, "rt_sigtimedwait" , NULL, NULL, NULL }, #endif @@ -1128,9 +1125,6 @@ #ifdef TARGET_NR_sigreturn { TARGET_NR_sigreturn, "sigreturn" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_sigsuspend -{ TARGET_NR_sigsuspend, "sigsuspend" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_socket { TARGET_NR_socket, "socket" , NULL, print_socket, NULL }, #endif