Message ID | 20180610030220.3777-41-richard.henderson@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2590282lji; Sat, 9 Jun 2018 20:32:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLUYzXdkfQd2GjbPWvNMTMXC5tp9d1cmWSiOeXd7Z7C6bw7XXJwVXcDt7YgGS9Ujfc518t7 X-Received: by 2002:ac8:25db:: with SMTP id f27-v6mr11781999qtf.128.1528601545713; Sat, 09 Jun 2018 20:32:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528601545; cv=none; d=google.com; s=arc-20160816; b=wMrUqwSZLG1Fdg6Pxmk3vLi7A5/KylPVjNUucpv0QdE2Or7aF7Y2xZjeQNx3umntZI Hrx2Srb0iYzWCai5gPUvgiUfmG4BXUP7Y4ZqHCkISe1dzWgKebE+2TjiQl4xSbEUxpyy /xn3FVbfnwYAReKxKa13lFaakBYbDdCXnU+hzbGbiszWdwhwcIAUrwNWZE5uqc2PEAa8 NZX6tZhHqsbWv5QqE1Fpm0IcsFU2ptOvbDel19L8KBj0LxznLAeJoXqa02quOArYhYJ3 wSiTwkLNx9S/DlCdP4O14+TRj7bcnsbQtR7ZrTyfb/vdO9ad2Z806tKqimn9LIdQs9i0 iKcQ== 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=QxGSXlqhVGnV3DO9GhiiNNbzyWrn3NgqnERUTAKyqCw=; b=ytE7TDnHJm4l68vRMkZJBqpHApRk2cRG30hRDXVA2/YCp3QgeUyQcB7w+wdxSRs/rm gwtJPUz437uhY+p6YLKSdXbripSsY4BNxwsPDe7DGunMCz+rM8E2PexmtLw+uGO6Bam9 FKqpAB5TIvasYbJ4eWKl+gWqdYdHl14Wi/3RX1xBV3HxALjz9aVBWjO/V3T8MjZeP/Yy ZL3sROAVNprrceXnXjC54MWNZZuWZRZluNIzj5Y2kVvoBOrHQGS/CyC8hpurgjA7FiWo 4zY0DfZvRezCZh4lWHUrJQ5jwI5mbWpg8fFKmjF9z/inlOdeyoRKd5i8OxSr5T7HA3e1 ORSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Savqus4i; 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: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s184-v6si3337077qkc.399.2018.06.09.20.32.25 for <patch@linaro.org> (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 20:32:25 -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=Savqus4i; 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]:42337 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+patch=linaro.org@nongnu.org>) id 1fRr5d-0002KN-3P for patch@linaro.org; Sat, 09 Jun 2018 23:32:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <richard.henderson@linaro.org>) id 1fRqe3-0002i7-9Y for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <richard.henderson@linaro.org>) id 1fRqe2-0003cc-7B for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:55 -0400 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:47032) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <richard.henderson@linaro.org>) id 1fRqe2-0003cM-1g for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:03:54 -0400 Received: by mail-pg0-x242.google.com with SMTP id d2-v6so8129647pga.13 for <qemu-devel@nongnu.org>; Sat, 09 Jun 2018 20:03:53 -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=QxGSXlqhVGnV3DO9GhiiNNbzyWrn3NgqnERUTAKyqCw=; b=Savqus4ilEky/EzdkHFzW3mBF6I9BmicTlRChWd7m16zVAXY5FexTyhPDC5CvF5bQZ ZmKkyDjkDkXpIl33qtmUDN558xtEtzneQ3s9ER52OjPsDxz1L5nAZdembpePw3Jx1pYQ r2JsG5i2UkAgSHJpjI3NX/tZQnvCtNq4y8slc= 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=QxGSXlqhVGnV3DO9GhiiNNbzyWrn3NgqnERUTAKyqCw=; b=ES82LSF/KwtFoeV9sw5YyyAqKkB+59UShab7bESdofkUcmqRQ8MXS9Qw+WqXnyBqsv kym3QkzNKBLRPZkugjsdrlAZLEvNXbrfmMeHY5c7LqSDIQaz8FQNPShgkx1m6VCUXGSy PphAPdcWr3W/vvju1p4NOu9d6W+TwVGC6ptnpmbxBjbe1AuoC4J+Aal0usht3yLjiZWE PNddDrdbGpAvxQU1Alb6pAccC3ZrikvC2CfcqcceykW0WW2jIW5hMX82lmFt9mtK+NmD ejV6qbnyukOd6rN2PnOCfJzbK8JJxly6YkYU0W+TROIbcVsMLsod2FPB5F6aa++ZBm8v 0ZRA== X-Gm-Message-State: APt69E3HfwgNlNIvYwb3qdAbIoNZ/6xUEp8OlPMiwNmT0AqnParFt9zI HIRPGPbZ8GNQ1JeVqvO7slwYaKlrTRM= X-Received: by 2002:a63:2b15:: with SMTP id r21-v6mr10433772pgr.269.1528599832826; Sat, 09 Jun 2018 20:03:52 -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.03.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:03:52 -0700 (PDT) From: Richard Henderson <richard.henderson@linaro.org> To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:01:12 -1000 Message-Id: <20180610030220.3777-41-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 040/108] linux-user: Split out mlock, mlockall, munlock, munlockall X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patch=linaro.org@nongnu.org> |
Series |
linux-user: Split do_syscall
|
expand
|
diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 7504ad74b5..f79aebe869 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -7144,21 +7144,6 @@ static inline abi_long target_to_host_sigevent(struct sigevent *host_sevp, return 0; } -#if defined(TARGET_NR_mlockall) -static inline int target_to_host_mlockall_arg(int arg) -{ - int result = 0; - - if (arg & TARGET_MLOCKALL_MCL_CURRENT) { - result |= MCL_CURRENT; - } - if (arg & TARGET_MLOCKALL_MCL_FUTURE) { - result |= MCL_FUTURE; - } - return result; -} -#endif - static inline abi_long host_to_target_stat64(void *cpu_env, abi_ulong target_addr, struct stat *host_st) @@ -8392,6 +8377,23 @@ IMPL(mknodat) return ret; } +IMPL(mlock) +{ + return get_errno(mlock(g2h(arg1), arg2)); +} + +IMPL(mlockall) +{ + int host_flags = 0; + if (arg1 & TARGET_MLOCKALL_MCL_CURRENT) { + host_flags |= MCL_CURRENT; + } + if (arg1 & TARGET_MLOCKALL_MCL_FUTURE) { + host_flags |= MCL_FUTURE; + } + return get_errno(mlockall(host_flags)); +} + #ifdef TARGET_NR_mmap IMPL(mmap) { @@ -8497,6 +8499,16 @@ IMPL(msync) return get_errno(msync(g2h(arg1), arg2, arg3)); } +IMPL(munlock) +{ + return get_errno(munlock(g2h(arg1), arg2)); +} + +IMPL(munlockall) +{ + return get_errno(munlockall()); +} + IMPL(munmap) { return get_errno(target_munmap(arg1, arg2)); @@ -9734,22 +9746,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, void *p; switch(num) { -#ifdef TARGET_NR_mlock - case TARGET_NR_mlock: - return get_errno(mlock(g2h(arg1), arg2)); -#endif -#ifdef TARGET_NR_munlock - case TARGET_NR_munlock: - return get_errno(munlock(g2h(arg1), arg2)); -#endif -#ifdef TARGET_NR_mlockall - case TARGET_NR_mlockall: - return get_errno(mlockall(target_to_host_mlockall_arg(arg1))); -#endif -#ifdef TARGET_NR_munlockall - case TARGET_NR_munlockall: - return get_errno(munlockall()); -#endif case TARGET_NR_truncate: if (!(p = lock_user_string(arg1))) return -TARGET_EFAULT; @@ -12762,6 +12758,8 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(mknod); #endif SYSCALL(mknodat); + SYSCALL(mlock); + SYSCALL(mlockall); #ifdef TARGET_NR_mmap SYSCALL(mmap); #endif @@ -12772,6 +12770,8 @@ static impl_fn *syscall_table(unsigned num) SYSCALL(mprotect); SYSCALL(mremap); SYSCALL(msync); + SYSCALL(munlock); + SYSCALL(munlockall); SYSCALL(munmap); #ifdef CONFIG_OPEN_BY_HANDLE SYSCALL(name_to_handle_at);
All targets define all of these; remove the ifdefs. Merge target_to_host_mlockall_arg into its only caller. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- linux-user/syscall.c | 62 ++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) -- 2.17.1