From patchwork Tue Oct 18 13:21:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 78047 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp889920qge; Tue, 18 Oct 2016 06:38:11 -0700 (PDT) X-Received: by 10.237.33.225 with SMTP id m30mr550599qtc.61.1476797891784; Tue, 18 Oct 2016 06:38:11 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id e124si11315218qkf.202.2016.10.18.06.38.11 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 18 Oct 2016 06:38:11 -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; 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 dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwUap-00033H-5R for patch@linaro.org; Tue, 18 Oct 2016 09:38:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwULJ-0006Jd-CA for qemu-devel@nongnu.org; Tue, 18 Oct 2016 09:22:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwULI-0000gS-6Q for qemu-devel@nongnu.org; Tue, 18 Oct 2016 09:22:09 -0400 Received: from mail-lf0-x22e.google.com ([2a00:1450:4010:c07::22e]:33395) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bwULH-0000ft-Uk for qemu-devel@nongnu.org; Tue, 18 Oct 2016 09:22:08 -0400 Received: by mail-lf0-x22e.google.com with SMTP id x79so355982161lff.0 for ; Tue, 18 Oct 2016 06:22:07 -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=ofFOPDNzOaJS37FltuZ+wAtlZRuzTw2iJyEd5Z31oh8=; b=Q/oyqNAri+IlMfK3vJhJlOxcFwig+5JFhOjk47JboZk5ch8aqwXL1Jgqxh+GSvT1vP XCxN68yjhZiuWdR0dukdvcRP27vslo6Xr74pfUV1/1hs+MZ4IkrOtAyOi4Y2UCiE3h5N BizmLnuDYO9UPw1gI/aRXeMCj4TU1MBDXZg5g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ofFOPDNzOaJS37FltuZ+wAtlZRuzTw2iJyEd5Z31oh8=; b=fnQ1uH4S5sAxfSFheNBArfryw71ZMAAxd4Z0mo0jVEqhWaPpXqhinKE4hGW80ktMgF BUfqBvnc9PqOjIGlxIlvYuMkjBsN3LcpvIFHP1CS550kEYZFmnnbNONFxG29nQOkdSft d5ueXOZl2Tltxg817nQHqtPyfjIBodxOAsd15SIjNQO4x/bS5Fe3qr0m7rwoWNmo1jn+ 1Pi2phGAN2y/O6PfNu2nrBx3zdKjV04vC9t2WU00Gv21bKAjLWSLs/rfueawLzoAmh4K J0ZR5PtSQJteNzPT/cMRd4hraDYmFE5XfoychH/SIOTlBY91rawV4Oz+otwgeXdvYRgK dH+g== X-Gm-Message-State: AA6/9Rlt9MUI+kfWY9K7u0piZY8EZS2wvF246iTHCEflQQcA152xThIgA8/2w3fnHxeE56wU X-Received: by 10.25.201.137 with SMTP id z131mr585258lff.144.1476796926520; Tue, 18 Oct 2016 06:22:06 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id 201sm9535359ljf.48.2016.10.18.06.22.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Oct 2016 06:22:05 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 18 Oct 2016 16:21:40 +0300 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::22e Subject: [Qemu-devel] [PULL v2 12/22] linux-user: use libc wrapper instead of direct mremap syscall 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: Peter Maydell , Felix Janda Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Felix Janda This commit essentially reverts commit 3af72a4d98dca033492102603734cbc63cd2694a, which has replaced five-argument calls to mremap() by direct mremap syscalls for compatibility with glibc older than version 2.4. The direct syscall was buggy for 64bit targets on 32bit hosts because of the default integer type promotions. Since glibc-2.4 is now a decade old, we can remove this workaround. Signed-off-by: Felix Janda Reviewed-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/mmap.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) -- 2.1.4 diff --git a/linux-user/mmap.c b/linux-user/mmap.c index c4371d9..ffd099d 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -17,8 +17,6 @@ * along with this program; if not, see . */ #include "qemu/osdep.h" -#include -#include #include "qemu.h" #include "qemu-common.h" @@ -681,10 +679,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, mmap_lock(); if (flags & MREMAP_FIXED) { - host_addr = (void *) syscall(__NR_mremap, g2h(old_addr), - old_size, new_size, - flags, - g2h(new_addr)); + host_addr = mremap(g2h(old_addr), old_size, new_size, + flags, g2h(new_addr)); if (reserved_va && host_addr != MAP_FAILED) { /* If new and old addresses overlap then the above mremap will @@ -700,10 +696,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, errno = ENOMEM; host_addr = MAP_FAILED; } else { - host_addr = (void *) syscall(__NR_mremap, g2h(old_addr), - old_size, new_size, - flags | MREMAP_FIXED, - g2h(mmap_start)); + host_addr = mremap(g2h(old_addr), old_size, new_size, + flags | MREMAP_FIXED, g2h(mmap_start)); if (reserved_va) { mmap_reserve(old_addr, old_size); }