From patchwork Sun Jun 10 03:01:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138138 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2598957lji; Sat, 9 Jun 2018 20:48:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI66zchK09hLYW0a5FDeUKfggpCW8x2H17I34BcLj+s7lJSGzp+QPmCqRXvKdS0nHQ4/MjY X-Received: by 2002:a0c:8c0b:: with SMTP id n11-v6mr10923490qvb.228.1528602521720; Sat, 09 Jun 2018 20:48:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528602521; cv=none; d=google.com; s=arc-20160816; b=Vkbued6WF6yzmUKih0VtrEQQJ/4AooctjFkUzKfw+l7HQTBpaYb6+KiA19gbgafuT5 wPdCHVspvvwbrOmzqVbLnnqbbZHTOC/qp+I7QQdJIxMhnw9wPzbyKt6le41jk/pyImv/ ED5NNUoovV18CGREKIYJtlTWMQTRoFy9no+fv5M+o+zRLHSAiL5p3rDEoOU6e0scNuPu aJrxFhY/BSNEzrF1rauK2SB3mrkanA1l6GX/vXcxgu2/j8NywZVcEP1NkaxoA01VuuiE 3uQ8nd0ocRzYbQ/qkcvL/6B5kh66By7unLh+lOTmSnKekExYN3gNQdVFA4YZRbEqTObm TyMQ== 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=irHbyPS+1lITcWMlCJqtgZWg28HnELfB+tyG6dr8bXU=; b=qJrGie/gYH5hJ9sVU2fVM8sGin5zI+RVBCNvjKagEH+OpVMHXK7ACmbzo5B9jEZDYf kwuUoNFT/hFEVChdsdlYJdIcrJhsM8xAM5nQqABxtS1j3SBOuUzdmajkkQBg9t3ZkzP+ K7ru3bqkE6PjQSuHbioPUzB+LvBLMO3E7GlL8yBFWGdFuinTKxBcV82gUzoAyBkX52Tf qyveGZUsQK2L8O2k4wDowKsH+yQ5cOCY04eMYCQ0YyvPPEF5FEcNpfsiz8/pbdfWoHMm BrcuAZgRVWTulEjxTbXAzbMkcTbAg6Hv+eLAnnfu9FIaH1CnqzWR9txDrNOit38rDcPM bTHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BqNWYVvh; 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 d36-v6si1708278qtk.281.2018.06.09.20.48.41 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 20:48:41 -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=BqNWYVvh; 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]:42425 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrLN-0001Qb-4q for patch@linaro.org; Sat, 09 Jun 2018 23:48:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqex-0003cy-PF for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqew-00044M-OR for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:51 -0400 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:35884) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqew-00043V-Hz for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:04:50 -0400 Received: by mail-pf0-x241.google.com with SMTP id a12-v6so8499528pfi.3 for ; Sat, 09 Jun 2018 20:04:50 -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=irHbyPS+1lITcWMlCJqtgZWg28HnELfB+tyG6dr8bXU=; b=BqNWYVvhfuiYS9Z9E5+E4fUruHJgeCxkb3WK0zA9det/rnPuATyf6yJz3rnUcYLD1t Wpz1ugkvXZQaIFrPbp7tTSaFwSU05a7WD6qVzwmWgzwgSu11dnmCvlvXeUlegCF92F9d cYDczu8pbJcOpmvsFVc/geyo8KHKQETUFM+KM= 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=irHbyPS+1lITcWMlCJqtgZWg28HnELfB+tyG6dr8bXU=; b=jejfpsu3E6IExklQKJLgW1TaeE2iH6j08MYGJRq+A8LNmlKJAHVhd6Y1qE8mspY6sx YnIe7YRO+qxhauBEL0UEJsJGsGO9ZTBW4MDG3p/GAasIf27Q8ZWJFWbn0ZD2lKCKdVnG gLmEwCH/0rVyJ810VH7l+7B9texTS1MT0UwPbYNFFtd57+nG81OQSkbeaPFYVL2w/bEb 9LE6VlR1sHK8LP3cgG4eg4xYHjpP2gd9XvWUfkabOA2LZsKv8Jkk5OCzTPPgm8XWjzog yRbwjufnO2twy5V7QY6tolPguStIFlXyVzZccX1YERXMI0rgOoBN+MX6QXyhvC/KcUmb +U3Q== X-Gm-Message-State: APt69E0/8kTaeUCP4yjgxP4aRYgst/ZnqAymYDr5rBKPRi7BGWooeHzd agIBexiuliBCrx7ftikllCoPz4S3ANA= X-Received: by 2002:a62:a104:: with SMTP id b4-v6mr12279064pff.159.1528599889350; Sat, 09 Jun 2018 20:04:49 -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.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:04:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:01:39 -1000 Message-Id: <20180610030220.3777-68-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:c00::241 Subject: [Qemu-devel] [PATCH v2 067/108] linux-user: Split out getcwd, pread64, pwrite64, sigaltstack 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 pread64 and pwrite64; remove the ifdefs. Signed-off-by: Richard Henderson --- linux-user/syscall.c | 88 ++++++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 32 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index e3765069ab..1e1ac8defd 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8161,6 +8161,19 @@ IMPL(getcpu) return ret; } +IMPL(getcwd) +{ + char *p = lock_user(VERIFY_WRITE, arg1, arg2, 0); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(sys_getcwd1(p, arg2)); + unlock_user(p, arg1, ret); + return ret; +} + #ifdef TARGET_NR_getdents IMPL(getdents) { @@ -9359,6 +9372,23 @@ IMPL(prctl) } } +IMPL(pread64) +{ + void *p = lock_user(VERIFY_WRITE, arg2, arg3, 0); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + if (regpairs_aligned(cpu_env, TARGET_NR_pread64)) { + arg4 = arg5; + arg5 = arg6; + } + ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5))); + unlock_user(p, arg2, ret); + return ret; +} + IMPL(preadv) { struct iovec *vec; @@ -9478,6 +9508,23 @@ IMPL(pselect6) return ret; } +IMPL(pwrite64) +{ + void *p = lock_user(VERIFY_READ, arg2, arg3, 1); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + if (regpairs_aligned(cpu_env, TARGET_NR_pwrite64)) { + arg4 = arg5; + arg5 = arg6; + } + ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5))); + unlock_user(p, arg2, 0); + return ret; +} + IMPL(pwritev) { struct iovec *vec; @@ -10359,6 +10406,11 @@ IMPL(sigaction) } #endif +IMPL(sigaltstack) +{ + return do_sigaltstack(arg1, arg2, get_sp_from_cpustate(cpu_env)); +} + #ifdef TARGET_NR_sigpending IMPL(sigpending) { @@ -11129,34 +11181,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { -#ifdef TARGET_NR_pread64 - case TARGET_NR_pread64: - if (regpairs_aligned(cpu_env, num)) { - arg4 = arg5; - arg5 = arg6; - } - if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0))) - return -TARGET_EFAULT; - ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5))); - unlock_user(p, arg2, ret); - return ret; - case TARGET_NR_pwrite64: - if (regpairs_aligned(cpu_env, num)) { - arg4 = arg5; - arg5 = arg6; - } - if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1))) - return -TARGET_EFAULT; - ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5))); - unlock_user(p, arg2, 0); - return ret; -#endif - case TARGET_NR_getcwd: - if (!(p = lock_user(VERIFY_WRITE, arg1, arg2, 0))) - return -TARGET_EFAULT; - ret = get_errno(sys_getcwd1(p, arg2)); - unlock_user(p, arg1, ret); - return ret; case TARGET_NR_capget: case TARGET_NR_capset: { @@ -11227,10 +11251,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, } return ret; } - case TARGET_NR_sigaltstack: - return do_sigaltstack(arg1, arg2, - get_sp_from_cpustate((CPUArchState *)cpu_env)); - #ifdef CONFIG_SENDFILE case TARGET_NR_sendfile: { @@ -13022,6 +13042,7 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(futimesat); #endif SYSCALL(getcpu); + SYSCALL(getcwd); #ifdef TARGET_NR_getdents SYSCALL(getdents); #endif @@ -13144,8 +13165,10 @@ static impl_fn *syscall_table(unsigned num) #endif SYSCALL(ppoll); SYSCALL(prctl); + SYSCALL(pread64); SYSCALL(preadv); SYSCALL(pselect6); + SYSCALL(pwrite64); SYSCALL(pwritev); SYSCALL(read); #ifdef TARGET_NR_readlink @@ -13254,6 +13277,7 @@ static impl_fn *syscall_table(unsigned num) #ifdef TARGET_NR_sigaction SYSCALL(sigaction); #endif + SYSCALL(sigaltstack); #ifdef TARGET_NR_sigpending SYSCALL(sigpending); #endif