From patchwork Mon Nov 20 21:21:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 119314 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4390292qgn; Mon, 20 Nov 2017 13:22:31 -0800 (PST) X-Google-Smtp-Source: AGs4zMZMYMNHr08MiWVURM7dYIsvz8ymrjfPxNp3IsRzKQc0HcaiUz4OTOZTlu07N2FQ4aL9A7sa X-Received: by 10.37.195.65 with SMTP id t62mr9362898ybf.71.1511212950986; Mon, 20 Nov 2017 13:22:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511212950; cv=none; d=google.com; s=arc-20160816; b=qg87DdTxcQmmRQ/n0b48nxMp1z0OwxRRuBZwMFLoLKPlCmCrLCmvTg7hZJr3eQMOf5 rQLYgxhxSJUYHMzjL4kdynt9WZkA9QTGFpJ7Clb26blZoVcNV/PAvRHLvW7k2KWlERYX gF08/qcdqlz63suKnI9Z4gQmIrNOP/cImt/gZQrk8O6wI/47fRaKAIZnrLj7p6RN3xUI 5rsXWY0RQf6EMdW24KysIBEz5Ks4l3Qki76AfuUeNYBc8x6xlsa5B1u3Chm3LmmuuoAr IKaDuZdNuJciJ0blGHRNmOrPMdz8uoDm1N1jeaLqowe8JKdWVWwqZ1lWE+StasmXP4w7 Mc3A== 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=Ug3qIumfGZ8e/5KNVP6eHDrA3Si8g9ay4B2NqWHPYm8=; b=PSMcCXUazBDZG5MKT5Yo2T4B2UzmQlkHe47yuUyo/fm+hVruHEWx1z9pHCkbEQL0hE BNKtcDGtSyjIFy+yV9MUJh598cO6MP8vgiRj+hcM9lezEu6bQGDnt1wMS1aB7K/iH/Gz xoSvMebQBBNSEbIRxCseMUXQMlTKnQ1NBE6pP/MqYj1PTwXOa9o+1BdDfm2+PSPvhT1a Z4KNLQSeqLG4yJFD/lJVb2YkBG7mFmiyL6srlB7SyfcFJKT9pMxSrcyuOHwQZ6SZaShA C1poC56fw/AKl7EJEsJYVGPrvv5IK+tSpZwKkt+CIciL5wtUa7Xzg/cJcHbYQiJ42ET+ pedQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=EPuLtKPy; 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 t13si1864528ybc.833.2017.11.20.13.22.30 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 20 Nov 2017 13:22:30 -0800 (PST) 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=EPuLtKPy; 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]:59804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGtWQ-0004mx-F2 for patch@linaro.org; Mon, 20 Nov 2017 16:22:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGtVv-0004cA-BN for qemu-devel@nongnu.org; Mon, 20 Nov 2017 16:22:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGtVt-0007rD-QU for qemu-devel@nongnu.org; Mon, 20 Nov 2017 16:21:59 -0500 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]:45633) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eGtVt-0007nZ-Eo for qemu-devel@nongnu.org; Mon, 20 Nov 2017 16:21:57 -0500 Received: by mail-lf0-x242.google.com with SMTP id f131so3687973lff.12 for ; Mon, 20 Nov 2017 13:21:57 -0800 (PST) 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=Ug3qIumfGZ8e/5KNVP6eHDrA3Si8g9ay4B2NqWHPYm8=; b=EPuLtKPyNaPMH/Ue+jFwZzUQKuewAm+O2MFt1int5oX1g3RuTnG8HEAP0ytmBhbbRx 0xXJI6yRResaS2T0lg8bf4/4oR71fhVsEpCKfoIeEddpHOFudJS2uIjYkTqsGjQyqPM0 KQcxFN5tE+Da+5DZ5lteE/CqRr/8lyAltSOfA= 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=Ug3qIumfGZ8e/5KNVP6eHDrA3Si8g9ay4B2NqWHPYm8=; b=BDr02tEFPBHrrrc3AIihZ2hhJh6fN6i84mKUm9z75Ve0/oTok8gWQLj+SqPGrm4whJ lugPX6L62rR0WainCw3mssx2X6zS3Yrn0H8QFwTzeaMJXXB/BAg3C7QyJvSFxejTsoRw 4sz2Lfw2h5jEblT5Ie4Ql0VGM9CasD4bsh8l25o9jbuWY3LwmRgZyVxcL6Rs952msxoi l3rhaWvHFvLZODOz1s5HycclvZrn18oHGQr3nYtEFLjG7u51LriPGEDxZ+RstG0qoYIM 0mr+Ugy27EuAHimlS1S9H5sqDnJNMpQRMfN9xqXIKBEmInBuxhMOAIXQ7Qf8nO0eocki Jx3w== X-Gm-Message-State: AJaThX5yXf4UGDerdiyRmt28cGqlJzCgbdcprXwciuCdnewOGHke+C/O qA7DasHeZ5xf7WONmNqC0hSU2Kude5k= X-Received: by 10.25.153.65 with SMTP id b62mr3822474lfe.109.1511212915929; Mon, 20 Nov 2017 13:21:55 -0800 (PST) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id v63sm1645409lje.39.2017.11.20.13.21.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Nov 2017 13:21:54 -0800 (PST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Mon, 20 Nov 2017 23:21:35 +0200 Message-Id: <541e1690420d293c1b09eeb128fac74e98cbef7a.1511212753.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::242 Subject: [Qemu-devel] [PULL 07/15] linux-user: Handle TARGET_MAP_STACK and TARGET_MAP_HUGETLB 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: Helge Deller Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Helge Deller Add the missing defines and for TARGET_MAP_STACK and TARGET_MAP_HUGETLB for alpha, mips, ppc, x86, hppa. Fix the mmap_flags translation table to translate MAP_HUGETLB between host and target architecture, and to drop MAP_STACK. Signed-off-by: Helge Deller Message-Id: <20170311183016.GA20514@ls3530.fritz.box> [rth: Drop MAP_STACK instead of translating it, since it is ignored in the kernel anyway. Fix tabs to spaces.] Signed-off-by: Richard Henderson Signed-off-by: Riku Voipio --- linux-user/syscall.c | 31 ++++++++++++++++++++----------- linux-user/syscall_defs.h | 10 ++++++++++ 2 files changed, 30 insertions(+), 11 deletions(-) -- 2.14.2 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index d4497dec5d..8047bf3aac 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5872,17 +5872,26 @@ static const StructEntry struct_termios_def = { }; static bitmask_transtbl mmap_flags_tbl[] = { - { TARGET_MAP_SHARED, TARGET_MAP_SHARED, MAP_SHARED, MAP_SHARED }, - { TARGET_MAP_PRIVATE, TARGET_MAP_PRIVATE, MAP_PRIVATE, MAP_PRIVATE }, - { TARGET_MAP_FIXED, TARGET_MAP_FIXED, MAP_FIXED, MAP_FIXED }, - { TARGET_MAP_ANONYMOUS, TARGET_MAP_ANONYMOUS, MAP_ANONYMOUS, MAP_ANONYMOUS }, - { TARGET_MAP_GROWSDOWN, TARGET_MAP_GROWSDOWN, MAP_GROWSDOWN, MAP_GROWSDOWN }, - { TARGET_MAP_DENYWRITE, TARGET_MAP_DENYWRITE, MAP_DENYWRITE, MAP_DENYWRITE }, - { TARGET_MAP_EXECUTABLE, TARGET_MAP_EXECUTABLE, MAP_EXECUTABLE, MAP_EXECUTABLE }, - { TARGET_MAP_LOCKED, TARGET_MAP_LOCKED, MAP_LOCKED, MAP_LOCKED }, - { TARGET_MAP_NORESERVE, TARGET_MAP_NORESERVE, MAP_NORESERVE, - MAP_NORESERVE }, - { 0, 0, 0, 0 } + { TARGET_MAP_SHARED, TARGET_MAP_SHARED, MAP_SHARED, MAP_SHARED }, + { TARGET_MAP_PRIVATE, TARGET_MAP_PRIVATE, MAP_PRIVATE, MAP_PRIVATE }, + { TARGET_MAP_FIXED, TARGET_MAP_FIXED, MAP_FIXED, MAP_FIXED }, + { TARGET_MAP_ANONYMOUS, TARGET_MAP_ANONYMOUS, + MAP_ANONYMOUS, MAP_ANONYMOUS }, + { TARGET_MAP_GROWSDOWN, TARGET_MAP_GROWSDOWN, + MAP_GROWSDOWN, MAP_GROWSDOWN }, + { TARGET_MAP_DENYWRITE, TARGET_MAP_DENYWRITE, + MAP_DENYWRITE, MAP_DENYWRITE }, + { TARGET_MAP_EXECUTABLE, TARGET_MAP_EXECUTABLE, + MAP_EXECUTABLE, MAP_EXECUTABLE }, + { TARGET_MAP_LOCKED, TARGET_MAP_LOCKED, MAP_LOCKED, MAP_LOCKED }, + { TARGET_MAP_NORESERVE, TARGET_MAP_NORESERVE, + MAP_NORESERVE, MAP_NORESERVE }, + { TARGET_MAP_HUGETLB, TARGET_MAP_HUGETLB, MAP_HUGETLB, MAP_HUGETLB }, + /* MAP_STACK had been ignored by the kernel for quite some time. + Recognize it for the target insofar as we do not want to pass + it through to the host. */ + { TARGET_MAP_STACK, TARGET_MAP_STACK, 0, 0 }, + { 0, 0, 0, 0 } }; #if defined(TARGET_I386) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index daa2a57398..bec3680b94 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1353,6 +1353,8 @@ struct target_winsize { #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */ #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */ #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ +#define TARGET_MAP_STACK 0x40000 /* ignored */ +#define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ #elif defined(TARGET_PPC) #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ @@ -1363,6 +1365,8 @@ struct target_winsize { #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */ #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ +#define TARGET_MAP_STACK 0x20000 /* ignored */ +#define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ #elif defined(TARGET_ALPHA) #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */ @@ -1373,6 +1377,8 @@ struct target_winsize { #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */ #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */ #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */ +#define TARGET_MAP_STACK 0x80000 /* ignored */ +#define TARGET_MAP_HUGETLB 0x100000 /* create a huge page mapping */ #elif defined(TARGET_HPPA) #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */ #define TARGET_MAP_FIXED 0x04 /* Interpret addr exactly */ @@ -1383,6 +1389,8 @@ struct target_winsize { #define TARGET_MAP_NORESERVE 0x04000 /* no check for reservations */ #define TARGET_MAP_POPULATE 0x10000 /* pop (prefault) pagetables */ #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */ +#define TARGET_MAP_STACK 0x40000 /* ignored */ +#define TARGET_MAP_HUGETLB 0x80000 /* create a huge page mapping */ #else #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */ #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */ @@ -1393,6 +1401,8 @@ struct target_winsize { #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */ #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */ +#define TARGET_MAP_STACK 0x20000 /* ignored */ +#define TARGET_MAP_HUGETLB 0x40000 /* create a huge page mapping */ #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */ #endif