From patchwork Mon Oct 17 13:24:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9379309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4DB5D600CA for ; Mon, 17 Oct 2016 13:47:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40210290A1 for ; Mon, 17 Oct 2016 13:47:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 339C4290E8; Mon, 17 Oct 2016 13:47:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8610C290A1 for ; Mon, 17 Oct 2016 13:47:39 +0000 (UTC) Received: from localhost ([::1]:33169 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw8GQ-0005F1-Pt for patchwork-qemu-devel@patchwork.kernel.org; Mon, 17 Oct 2016 09:47:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bw7ub-0003HO-Cl for qemu-devel@nongnu.org; Mon, 17 Oct 2016 09:25:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bw7uX-0003FK-99 for qemu-devel@nongnu.org; Mon, 17 Oct 2016 09:25:05 -0400 Received: from mail-lf0-x233.google.com ([2a00:1450:4010:c07::233]:34486) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bw7uX-0003Ed-0o for qemu-devel@nongnu.org; Mon, 17 Oct 2016 09:25:01 -0400 Received: by mail-lf0-x233.google.com with SMTP id b81so285338551lfe.1 for ; Mon, 17 Oct 2016 06:25:00 -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=bfCCCI+5L1HdeMhETwOZZVsIAyPXaJeytB4Fe1d+WqV36kTJ1B3ko4/DpdG8/ciW9d A9gwS4EVJWphk8rFeAs4IvEj1SFDZHUIi8cppTgf+2H5BWIjKzBZKcBY94lVQIImlrtk iM7TboxkxixLfHiOUygdAc4Sud7xEkTiNoJng= 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=HQ1eWKG22nnnoCphTLrcwAFKXCNMDvy90DZWwJ6+gBk/3kInfz2Ja4azo8EDXgsw8O mjLz9CS4zNU8CIZbZQ2hsE/5+o6XFphHkN8yrzCHGaEVTBmcqnX557qjntCvq2q5On8R PG1+Vy3rcoPx4d2YffhQ/SrFzo+ZKqIfk+UNd8SEzJqVIS4A+JHYQZs3DnG6RA9rMJKf PS487qp60yDdTcmEd5kQ+6YYzZ2aGIgT/sjTlCIXnOJacz47pOMh0cnYi7I0uq6Ac93X niN+GuV3ivJaLvvwY4TySh/IGeOrNgQWo+9JZcAn+d5VIk4HZhfgw9qbgCsU4r4sTodi vHNg== X-Gm-Message-State: AA6/9RkGxY9IcXIZbD/ukYbea18LNL+ncucASXxv71WgpnvmAvmWHn13C/mRNzyA571D9Nuo X-Received: by 10.25.133.11 with SMTP id h11mr15095277lfd.60.1476710697967; Mon, 17 Oct 2016 06:24:57 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id y81sm7782857lff.29.2016.10.17.06.24.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Oct 2016 06:24:56 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 17 Oct 2016 16:24:30 +0300 Message-Id: <4e767d00ff8ca0bb0ccf55365372c623718152af.1476710353.git.riku.voipio@linaro.org> 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::233 Subject: [Qemu-devel] [PULL 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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); }