From patchwork Sun Jun 10 03:02:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138170 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2612546lji; Sat, 9 Jun 2018 21:12:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ9hJTa9iu6bTzqD9ftStPgUEUnqWR5/gjG6RaTTx7WQYv7xeMfWT30/8E0lMGnKV52Qa8R X-Received: by 2002:a37:76c3:: with SMTP id r186-v6mr10597491qkc.409.1528603922559; Sat, 09 Jun 2018 21:12:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528603922; cv=none; d=google.com; s=arc-20160816; b=cnzwHb9TzD09maOJ2VDOlCf5FlUoREMq/VxPHifuQ0vjGpoimBIakQZmOMCpSXYS95 BnoRBiAPSxHr4cfILjb2g7kBWXqZMK54AOVifMSexDVsmmM0v70YBigN8ThNVGn6u5I4 v77dNZOda7IkiKmio7DAQHLfSPt7F1IFR0w7Zq06cgTbhkpKR12oKb6iDh4RuDZ+DWkf k+4hXja1PqncMLfDLr3fvGDsW1f6KHeNeKDjHwQXgn3h+0TRFIS4c1wBL2muCISrZHkZ 1BthGXMgC8lxmfcQxd7xYaNnvEpTF/n4e7jm5M2ztfK6Gl0BYQN27kiUWmclz9x4p8Zs pLSQ== 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:arc-authentication-results; bh=8tu6OgeglohkggMq2uPZwP09LlUOjWkkuYF//UVbFN4=; b=a/iBXBb/jCCBGA4ie9ZvyVGCnGN2BTJdoORksA1Yh3asto/+XhBeLqwfpnNGDi3QXv jh6Tjc7mwb5T/6gP248E/IEuSqYe6r/7ipPErUq9FIHUkV1Dq4JWQ6J5rIpKLIssz+N6 cHcbND7tUSC6Fqw1cXWI/5NcW/wubMf1yEm8T95r3S0hoxb8ci7UPyaK4myZnLai9MNK dGxD8TrslW8rRFJY7gxclQzrIdiO48wua4agohgA0iKz7JjXcKXl2ZS6/oKPgkcyHEqM jTc5FZ7ZRCSEx6SkW4IFceC1+Gxy7DinLobdEGoOVWkYk6nqzdMwHZDkoC04AqCxEznC HYPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dO1fS8+T; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u6-v6si912927qkc.122.2018.06.09.21.12.02 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 21:12:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dO1fS8+T; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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 ([::1]:42564 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrhy-0006T5-0H for patch@linaro.org; Sun, 10 Jun 2018 00:12:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqfg-0004LU-Jh for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqff-0004fX-JV for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:36 -0400 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:33747) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqff-0004fJ-D1 for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:35 -0400 Received: by mail-pl0-x241.google.com with SMTP id n10-v6so10392216plp.0 for ; Sat, 09 Jun 2018 20:05:35 -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=8tu6OgeglohkggMq2uPZwP09LlUOjWkkuYF//UVbFN4=; b=dO1fS8+TzzyJvqDrJEXr6E4oZjpSGcv+g4ZW859sigeF4nWw+OXgjnGVoV7b+NiKee eoMbjY5B1uE+yXU9GioPphaJvOt2Lu/SoIHvECY2yktgmhLyysGF/OplALNd8LQDW0qc OmgwQwBIG7CfeXR36iZl67sVP+mT1yyQveN2c= 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=8tu6OgeglohkggMq2uPZwP09LlUOjWkkuYF//UVbFN4=; b=Vr0m4u/DbNzvjfL8KKt2IFc/Pv5Zt6Awq73PhzumXaJ/ATKeL9CA6O3dcaBDpaurOy qjjpIsUeq+mTcRSAF/XK/gRRodFVLIqOSofzEMhG1X/Txe4IS5dRqcKY25Bu0Cn7fTBR FrOTmMT17rJ4dyk1J1raS4mSO1IzV/ip5Ub7zy5piYK60LBavPJ371qigjU/Di5A9+Fj aFHVTxzqkToxBEjNZX98c+Mp7rzRJWJLLk+tpYf8h/49h66Pz2hQGqHx4XQ3puTQgBbi PFk2lHBgdDZhY029gkgyeQchkTowByMDt3dtEN5jN0uCwE9HhbKcpOs7yMEwmB8Ev7n1 Iexw== X-Gm-Message-State: APt69E1TtU+9067x0OdYQOwCXjPXjOHF+k0Z0gYJ5C4cK/RjyX40B9kq fLF/S8ULS10M4yIo7XcaLoaTvXtvywM= X-Received: by 2002:a17:902:8e87:: with SMTP id bg7-v6mr12899143plb.129.1528599934246; Sat, 09 Jun 2018 20:05:34 -0700 (PDT) Received: from cloudburst.twiddle.net (rrcs-173-198-77-219.west.biz.rr.com. [173.198.77.219]) by smtp.gmail.com with ESMTPSA id y17-v6sm31712718pfe.33.2018.06.09.20.05.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:05:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:02:03 -1000 Message-Id: <20180610030220.3777-92-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180610030220.3777-1-richard.henderson@linaro.org> References: <20180610030220.3777-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::241 Subject: [Qemu-devel] [PATCH v2 091/108] linux-user: Split out set_tid_address, tgkill, tkill 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" All targets define set_tid_address; remove the ifdef. Use the bogus syscall method to supply the host syscall. Signed-off-by: Richard Henderson --- linux-user/syscall.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 1c1e05dc26..8406b9d8d3 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -250,6 +250,9 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \ #ifndef __NR_gettid #define __NR_gettid -1 #endif +#ifndef __NR_set_tid_address +#define __NR_set_tid_address -1 +#endif _syscall0(int, gettid) @@ -278,9 +281,7 @@ _syscall3(int,sys_syslog,int,type,char*,bufp,int,len) #ifdef __NR_exit_group _syscall1(int,exit_group,int,error_code) #endif -#if defined(TARGET_NR_set_tid_address) && defined(__NR_set_tid_address) _syscall1(int,set_tid_address,int *,tidptr) -#endif #if defined(TARGET_NR_futex) && defined(__NR_futex) _syscall6(int,sys_futex,int *,uaddr,int,op,int,val, const struct timespec *,timeout,int *,uaddr2,int,val3) @@ -11578,6 +11579,11 @@ IMPL(set_thread_area) } #endif +IMPL(set_tid_address) +{ + return get_errno(set_tid_address((int *)g2h(arg1))); +} + IMPL(settimeofday) { struct timeval tv; @@ -12210,6 +12216,12 @@ IMPL(syslog) } } +IMPL(tgkill) +{ + return get_errno(safe_tgkill((int)arg1, (int)arg2, + target_to_host_signal(arg3))); +} + #ifdef TARGET_NR_time IMPL(time) { @@ -12244,6 +12256,11 @@ IMPL(times) return host_to_target_clock_t(ret); } +IMPL(tkill) +{ + return get_errno(safe_tkill((int)arg1, target_to_host_signal(arg2))); +} + IMPL(truncate) { char *p = lock_user_string(arg1); @@ -12562,19 +12579,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { -#if defined(TARGET_NR_set_tid_address) && defined(__NR_set_tid_address) - case TARGET_NR_set_tid_address: - return get_errno(set_tid_address((int *)g2h(arg1))); -#endif - - case TARGET_NR_tkill: - return get_errno(safe_tkill((int)arg1, target_to_host_signal(arg2))); - - case TARGET_NR_tgkill: - return get_errno(safe_tgkill((int)arg1, (int)arg2, - target_to_host_signal(arg3))); - - #if defined(TARGET_NR_utimensat) case TARGET_NR_utimensat: { @@ -13762,6 +13766,7 @@ static impl_fn *syscall_table(unsigned num) #ifdef TARGET_NR_set_thread_area SYSCALL(set_thread_area); #endif + SYSCALL(set_tid_address); SYSCALL(settimeofday); SYSCALL(setsid); SYSCALL(setuid); @@ -13827,10 +13832,12 @@ static impl_fn *syscall_table(unsigned num) #endif SYSCALL(sysinfo); SYSCALL(syslog); + SYSCALL(tgkill); #ifdef TARGET_NR_time SYSCALL(time); #endif SYSCALL(times); + SYSCALL(tkill); SYSCALL(truncate); #ifdef TARGET_NR_truncate64 SYSCALL(truncate64);