Message ID | 20180618140835.195901-12-sjg@chromium.org |
---|---|
State | Superseded |
Delegated to: | Alexander Graf |
Headers | show
Return-Path: <u-boot-bounces@lists.denx.de> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 418Y6s6y4Mz9ryk for <incoming@patchwork.ozlabs.org>; Tue, 19 Jun 2018 00:16:21 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 7550AC21E85; Mon, 18 Jun 2018 14:10:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 02633C21E36; Mon, 18 Jun 2018 14:09:52 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C7B35C21D65; Mon, 18 Jun 2018 14:09:17 +0000 (UTC) Received: from mail-qt0-f201.google.com (mail-qt0-f201.google.com [209.85.216.201]) by lists.denx.de (Postfix) with ESMTPS id 6AB69C21E50 for <u-boot@lists.denx.de>; Mon, 18 Jun 2018 14:09:12 +0000 (UTC) Received: by mail-qt0-f201.google.com with SMTP id p12-v6so14078024qtg.5 for <u-boot@lists.denx.de>; Mon, 18 Jun 2018 07:09:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=xM8bbJktdT8zZ2RwxSfC1Y5ytvm5lFPsdErzTrfyZL4=; b=OsIjSutwPHJr9yWJGstuxrePXEx8U+xoGOC2xBDWJgBFgE/WU6uJt8R7G+MtvsLusU hWCRyo7qFNi27B+NiO/0ooq1sQjRPETxOrIZ0fwIOhd9WThEjNwFJcb63gpo03Y89hs7 V1TfhRTOG2/vdAhCGgIs3CNwT0qlrT2WEu3U+WOD/vLRO+whF3fBAhsOFsMy3wJlKgMk NPn5rsSDHHJwPUfmZPs21moS1mhNEpAsQklojRlG4HD9Hi1ikGkJdMydfqh0MzE5QnTf 69TXxx93kL6wPYQgXGWxMwNrEKhfkOACKeuDxsa9HoQMz57oIvvYTl4xswxlfYt4F/vo hwTw== X-Gm-Message-State: APt69E0JnkHRfUsMB16PT8d7tVssd2N/FXbigoFnUw31ybjdKB3NATLg 5GynWfc0Q3FOFVqg3i3AGoIeIwM= X-Google-Smtp-Source: ADUXVKKB5JRSXQs99GwzCBrSoT4FiMjd7Xvcyza1P1r1DiXf9GGbAEKgWvQzcDfI/jNYXqj+iLqWrek= MIME-Version: 1.0 X-Received: by 2002:a0c:8b4a:: with SMTP id d10-v6mr7027967qvc.14.1529330951528; Mon, 18 Jun 2018 07:09:11 -0700 (PDT) Date: Mon, 18 Jun 2018 08:08:16 -0600 In-Reply-To: <20180618140835.195901-1-sjg@chromium.org> Message-Id: <20180618140835.195901-12-sjg@chromium.org> References: <20180618140835.195901-1-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog From: Simon Glass <sjg@chromium.org> To: U-Boot Mailing List <u-boot@lists.denx.de> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Heinrich Schuchardt <xypron.glpk@gmx.de>, Alexander Graf <agraf@suse.de> Subject: [U-Boot] [PATCH v8 11/30] sandbox: Align RAM buffer to the machine page size X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <http://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> |
Series |
efi: Enable sandbox support for EFI loader
|
expand
|
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 5839932b00..a1a982af2d 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -143,14 +143,15 @@ void os_tty_raw(int fd, bool allow_sigs) void *os_malloc(size_t length) { struct os_mem_hdr *hdr; + int page_size = getpagesize(); - hdr = mmap(NULL, length + sizeof(*hdr), PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + hdr = mmap(NULL, length + page_size, + PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (hdr == MAP_FAILED) return NULL; hdr->length = length; - return hdr + 1; + return (void *)hdr + page_size; } void os_free(void *ptr)
At present the sandbox RAM buffer is not aligned to any particular address boundary. This makes the internal pointers somewhat random with respect to the associated RAM buffer addresses. Align the buffer to the page size of the machine to help with this. Signed-off-by: Simon Glass <sjg@chromium.org> --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None arch/sandbox/cpu/os.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)