From patchwork Sun Jun 10 03:01:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138141 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2600151lji; Sat, 9 Jun 2018 20:51:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ+aSsWYpLw80NwpLHr6tx+L4mCBCTdVxI8Iw8Jd5ei3EkDpehFmyHamscDG8pKBcDqWe/B X-Received: by 2002:ac8:720f:: with SMTP id a15-v6mr11080180qtp.243.1528602661578; Sat, 09 Jun 2018 20:51:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528602661; cv=none; d=google.com; s=arc-20160816; b=S8XOKqS4S/9sr0gX1zuhlLuNRFHENtq2IlFW6wcsfbyePKR/rmHhC03kH5VnY+dp1x RzAmQ5+STNAFiOBJb0h1D21qbaqmG7uYSmzT6B3WlYTJ1zG7GMP9dgN7mZZfL/mZxfCX gwF/UozA7re31cLjqbCtbKWwbsOufSlZh/DUWqS2KdW3sZPQlXcresz8EsvHWtFUUb1O IgRKVK/Td2qq5puUey/GZblN+FEZI1UO5DiqI2R6rTPhW4XEam5b6f4mMRY9droGcBlH aQY4TVHqJpdfA1kBO0/yVuZ6ONxgZnQReZVdkG3S+V4oOimG3w5Hi6DUa8kKoZjUebyi bxuQ== 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=KDrYlD4y0ZQb7noKMHlGiVzA+1uZZIv4M/OeCZr0M8s=; b=SEfACAwJqJEod2DZCioS4kGSRsN3rjieTfbM+aHZuP+6kkbhyh+yFbTb0w/D4T5xJQ p8NwLig/RsMdFTRR6ZBRu28TTybKcdZlnAdpTE0QRILFGW1AKRdrQKraGhJ5u9RfZGSn xxRHmq7wHH+0UwKOu2xyIlxK3MWOIR2GXg58r5/1IVfwydzmZchXipyzYW+jFkvUsc5V u7kHpSQ3RHtNiyU3jB8nRROWUenR/DbE5ZqhX48jdZxdatWz2dXIj8v8y/NLRDcZwpI1 SL+XGrBnVqTRGId03pXNzn2Turwca9C+bAe/2kjPhvMCBX7LBsm/HoOKdmzQclAS+oJ6 6Jvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Q22TzBzd; 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 h19-v6si5740640qta.374.2018.06.09.20.51.01 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 20:51:01 -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=Q22TzBzd; 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]:42441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrNc-0003wL-SJ for patch@linaro.org; Sat, 09 Jun 2018 23:51:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqec-0003H5-Lc for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqeb-0003nx-C8 for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:30 -0400 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:38928) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqeb-0003nr-6F for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:29 -0400 Received: by mail-pg0-x242.google.com with SMTP id w12-v6so8139290pgc.6 for ; Sat, 09 Jun 2018 20:04:29 -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=KDrYlD4y0ZQb7noKMHlGiVzA+1uZZIv4M/OeCZr0M8s=; b=Q22TzBzdaQc/099X4/z8ZuNj+SracIyGSylMzx5IkVJvM8MN6g21jeaeMq0z/245xd wdx+f24Z7xAG5CbGHkOM6lYfMSKC41W6kfkADkMwHvH6CMg1IeV6LhzR941/wK5lwYga 1fNeQDIVrExuQDavuLTG0/lIYFeOY8uT8nuO0= 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=KDrYlD4y0ZQb7noKMHlGiVzA+1uZZIv4M/OeCZr0M8s=; b=DJvj9ID5gwUMkWOckn6kQdhUuHUTmt126sq57Onq6CUIyyc7DT7TxSEAIIYyF1N9zo gxrfpoSOEy9mEwk8kD0+FWvZMKhs9EBXAmNzv48O2NXUWelfvqlNqy1XTPPx/R+9I/eC KrfHv6GLuNFmkuKQD8h0bCLraa6Fxf7hkQLbgCbQ7gYppUZP3ZWpuEVe6OuJGHUQc/O3 SNNHSYvF0grC5beJCmF1nF6AEiu1OfapVO/rBLJ7jHTIF6Yr1LgehADmDIjAJbI5Yhuk vcBh5e7Ip6f06Qi7hxpqGjWfUrjcep2QOQVmqj9ImOEa/d7VpE5YldnSRFnh+BNxqDVN 9ppA== X-Gm-Message-State: APt69E27nXA3gWZufKqu5mvjT470wJYSXDPOHm49iaiV03hDcS25W/hz YQX5ICgVpH1EUWKYXW6eNpnHWWx7GNg= X-Received: by 2002:a63:3641:: with SMTP id d62-v6mr10186086pga.18.1528599868055; Sat, 09 Jun 2018 20:04:28 -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.04.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:04:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:01:28 -1000 Message-Id: <20180610030220.3777-57-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:c05::242 Subject: [Qemu-devel] [PATCH v2 056/108] linux-user: Split out clone, exit_group, fsync 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.c | 70 ++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 28 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 1c3a4590fb..41facf4b44 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7753,6 +7753,25 @@ IMPL(chroot) return ret; } +IMPL(clone) +{ + /* Linux manages to have three different orderings for its + * arguments to clone(); the BACKWARDS and BACKWARDS2 defines + * match the kernel's CONFIG_CLONE_* settings. + * Microblaze is further special in that it uses a sixth + * implicit argument to clone for the TLS pointer. + */ +#if defined(TARGET_MICROBLAZE) + return get_errno(do_fork(cpu_env, arg1, arg2, arg4, arg6, arg5)); +#elif defined(TARGET_CLONE_BACKWARDS) + return get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg4, arg5)); +#elif defined(TARGET_CLONE_BACKWARDS2) + return get_errno(do_fork(cpu_env, arg2, arg1, arg3, arg5, arg4)); +#else + return get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg5, arg4)); +#endif +} + IMPL(close) { fd_trans_unregister(arg1); @@ -7973,6 +7992,17 @@ IMPL(exit) g_assert_not_reached(); } +#ifdef __NR_exit_group +IMPL(exit_group) +{ +# ifdef TARGET_GPROF + _mcleanup(); +# endif + gdb_exit(cpu_env, arg1); + return get_errno(exit_group(arg1)); +} +#endif + IMPL(faccessat) { char *p = lock_user_string(arg2); @@ -8056,6 +8086,11 @@ IMPL(fstatfs64) } #endif +IMPL(fsync) +{ + return get_errno(fsync(arg1)); +} + IMPL(ftruncate) { return get_errno(ftruncate(arg1, arg2)); @@ -10349,34 +10384,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { - case TARGET_NR_fsync: - return get_errno(fsync(arg1)); - case TARGET_NR_clone: - /* Linux manages to have three different orderings for its - * arguments to clone(); the BACKWARDS and BACKWARDS2 defines - * match the kernel's CONFIG_CLONE_* settings. - * Microblaze is further special in that it uses a sixth - * implicit argument to clone for the TLS pointer. - */ -#if defined(TARGET_MICROBLAZE) - ret = get_errno(do_fork(cpu_env, arg1, arg2, arg4, arg6, arg5)); -#elif defined(TARGET_CLONE_BACKWARDS) - ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg4, arg5)); -#elif defined(TARGET_CLONE_BACKWARDS2) - ret = get_errno(do_fork(cpu_env, arg2, arg1, arg3, arg5, arg4)); -#else - ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg5, arg4)); -#endif - return ret; -#ifdef __NR_exit_group - /* new thread calls */ - case TARGET_NR_exit_group: -#ifdef TARGET_GPROF - _mcleanup(); -#endif - gdb_exit(cpu_env, arg1); - return get_errno(exit_group(arg1)); -#endif case TARGET_NR_setdomainname: if (!(p = lock_user_string(arg1))) return -TARGET_EFAULT; @@ -12877,6 +12884,7 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(bind); #endif SYSCALL(brk); + SYSCALL(clone); SYSCALL(close); SYSCALL(chdir); SYSCALL(chroot); @@ -12896,6 +12904,11 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(dup3); SYSCALL(execve); SYSCALL(exit); +#ifdef __NR_exit_group + SYSCALL(exit_group); +#else + SYSCALL_WITH(exit_group, enosys); +#endif SYSCALL(faccessat); SYSCALL(fchmod); SYSCALL(fchmodat); @@ -12910,6 +12923,7 @@ static impl_fn *syscall_table(unsigned num) #ifdef TARGET_NR_fstatfs64 SYSCALL(fstatfs64); #endif + SYSCALL(fsync); SYSCALL(ftruncate); #ifdef TARGET_NR_futimesat SYSCALL(futimesat);