From patchwork Tue Feb 28 17:19:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alessandro Di Federico X-Patchwork-Id: 9596393 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 0BE0F600CB for ; Tue, 28 Feb 2017 17:31:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F39BF281DB for ; Tue, 28 Feb 2017 17:31:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6D6C28547; Tue, 28 Feb 2017 17:31:53 +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 4BEEF281DB for ; Tue, 28 Feb 2017 17:31:53 +0000 (UTC) Received: from localhost ([::1]:35853 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cilcu-0006RX-BZ for patchwork-qemu-devel@patchwork.kernel.org; Tue, 28 Feb 2017 12:31:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cilPl-0003I7-9S for qemu-devel@nongnu.org; Tue, 28 Feb 2017 12:18:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cilPi-0003hO-1e for qemu-devel@nongnu.org; Tue, 28 Feb 2017 12:18:17 -0500 Received: from clearmind.me ([178.32.49.9]:57881) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cilPh-0003gM-Qj for qemu-devel@nongnu.org; Tue, 28 Feb 2017 12:18:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=clearmind.me; s=dkim; h=Sender:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=q5HMAIbWkFakodX4PFPOSeXN4JuwcC6MURQG2DlqxWA=; b=mEKYARUpuGajxa9IECTI8Ac4v 786e8dqshUqZ0ziBKRg7ZdxrBRxtbnLBIXD4n6DTaUo+41XwUKJ7JGoZeFW+oTLCdBnM6j4TsBir6 2ZUrXGfZPou1Se6/HfeCEzDHUbOssywCr4ksGLWbpMKMFeYPeNa4kll9NHzyM1KOLOy7s=; From: Alessandro Di Federico To: qemu-devel@nongnu.org Date: Tue, 28 Feb 2017 18:19:16 +0100 Message-Id: <20170228171921.21602-3-ale+qemu@clearmind.me> In-Reply-To: <20170228171921.21602-1-ale+qemu@clearmind.me> References: <20170228171921.21602-1-ale+qemu@clearmind.me> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.32.49.9 Subject: [Qemu-devel] [PATCH 2/7] Factor out *-user/mmap.c 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This commit moves linux-user/mmap.c to the top level directory so that it can be employed by bsd-user (when it will be back in a working shape) and libtcg. --- Makefile.target | 1 + include/qemu-user-common.h | 17 +++++++++++++++++ linux-user/Makefile.objs | 2 +- linux-user/qemu.h | 16 ---------------- linux-user/mmap.c => mmap.c | 0 5 files changed, 19 insertions(+), 17 deletions(-) rename linux-user/mmap.c => mmap.c (100%) diff --git a/Makefile.target b/Makefile.target index 924304c9e6..cf8adc3ced 100644 --- a/Makefile.target +++ b/Makefile.target @@ -89,6 +89,7 @@ all: $(PROGS) stap ######################################################### # cpu emulator library obj-y = exec.o translate-all.o cpu-exec.o +obj-$(call land,$(CONFIG_USER_ONLY),$(call lnot,$(CONFIG_BSD_USER))) += mmap.o obj-y += translate-common.o obj-y += cpu-exec-common.o obj-y += tcg/tcg.o tcg/tcg-op.o tcg/optimize.o diff --git a/include/qemu-user-common.h b/include/qemu-user-common.h index 349dd72fff..e772f54c8f 100644 --- a/include/qemu-user-common.h +++ b/include/qemu-user-common.h @@ -177,4 +177,21 @@ static inline void *lock_user_string(abi_ulong guest_addr) #define unlock_user_struct(host_ptr, guest_addr, copy) \ unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0) +/* mmap.c */ +extern unsigned long mmap_min_addr; + +int target_mprotect(abi_ulong start, abi_ulong len, int prot); +abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, + int flags, int fd, abi_ulong offset); +int target_munmap(abi_ulong start, abi_ulong len); +abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, + abi_ulong new_size, unsigned long flags, + abi_ulong new_addr); +int target_msync(abi_ulong start, abi_ulong len, int flags); +extern unsigned long last_brk; +extern abi_ulong mmap_next_start; +abi_ulong mmap_find_vma(abi_ulong, abi_ulong); +void mmap_fork_start(void); +void mmap_fork_end(int child); + #endif /* QEMU_USER_COMMON_H */ diff --git a/linux-user/Makefile.objs b/linux-user/Makefile.objs index 8c93058100..1595f44d12 100644 --- a/linux-user/Makefile.objs +++ b/linux-user/Makefile.objs @@ -1,4 +1,4 @@ -obj-y = main.o syscall.o strace.o mmap.o signal.o \ +obj-y = main.o syscall.o strace.o signal.o \ elfload.o linuxload.o uaccess.o uname.o \ safe-syscall.o diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 22b0ad7d30..5cfe68bd43 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -156,7 +156,6 @@ void init_task_state(TaskState *ts); void task_settid(TaskState *); void stop_all_tasks(void); extern const char *qemu_uname_release; -extern unsigned long mmap_min_addr; /* ??? See if we can avoid exposing so much of the loader internals. */ @@ -420,21 +419,6 @@ void sparc64_set_context(CPUSPARCState *env); void sparc64_get_context(CPUSPARCState *env); #endif -/* mmap.c */ -int target_mprotect(abi_ulong start, abi_ulong len, int prot); -abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, - int flags, int fd, abi_ulong offset); -int target_munmap(abi_ulong start, abi_ulong len); -abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, - abi_ulong new_size, unsigned long flags, - abi_ulong new_addr); -int target_msync(abi_ulong start, abi_ulong len, int flags); -extern unsigned long last_brk; -extern abi_ulong mmap_next_start; -abi_ulong mmap_find_vma(abi_ulong, abi_ulong); -void mmap_fork_start(void); -void mmap_fork_end(int child); - /* main.c */ extern unsigned long guest_stack_size; diff --git a/linux-user/mmap.c b/mmap.c similarity index 100% rename from linux-user/mmap.c rename to mmap.c