From patchwork Fri Jun 22 12:44:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 139612 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp832104lji; Fri, 22 Jun 2018 05:47:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKYT+9Dz0OzN2d+ozq7O8SEo+KSClnAQNnz/bJLVwhTcc4p41VLtbpGx6txFtF6XgSQgp8l X-Received: by 2002:a50:8c41:: with SMTP id p59-v6mr1726393edp.207.1529671640270; Fri, 22 Jun 2018 05:47:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529671640; cv=none; d=google.com; s=arc-20160816; b=rU6vNggMwlUq/Of/4TZMz+yxbuMiTUZ1qwqKBLyeMyUkMNs3IRNdhuKhkxz24NMXDu jQ+22VyJXZ98RloPB6YJmq7yA4YNlYZNmmwPFT7E7E/DEPRdHg9yLNR7B1Z8IfS1tJIu Xfo3Jrk+QzOgPebci7M7OsF5PEHXY9RpKwsnUc7eHHTPTu3PLQd1VSklQC/trUM5nHRn qb0S1XWyjZTtiNeBGTfxBFTkr2gyODMtrx3+SXUixyYramnYjHsJL2qy0dQlz7Ach3kW FMe32A593e8T2mNyqVhEDKqVxbTQHlDpAKJNmfiCsF1YvIAJO50h50C5BcceY+Va7mSP uobA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=3Ut+M3EdY8GDDCLsMrZanBpyhTprIcM5W82JFGrjy9Y=; b=wwvTQH5CiaZSTsP5vkJYg/07KTxpljXw9yCW/3orYzF8r4QoWaihfJuamM3v3miKLl yAVVUxCTQOTGvrLgayDgAWxYsdgvq3Sf+q0CCk4QYALzng11VWqK+vMABf0MQjgv/i6v +c5ZLbvqhVVvsNCj6+dUux7RJCD9pWm7/IWYvZ4YmGT0FySPFzPdw7UN/Rz/dtZscdJX J5IwbPdUs5yq49bho342bgOr0YZXVD/YVK6SWpXZ8vEeFvrsA73z4iUudCkca0UOcvbF D+YZ/R08AgdV1UlJwYLAWe/2Vg1v7LX8pACA9Ic8ShRRihYlmbRLZ0gcRH5H6WF/hxc4 M0PQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 5-v6si3696536edn.30.2018.06.22.05.47.20; Fri, 22 Jun 2018 05:47:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id E34CEC21F93; Fri, 22 Jun 2018 12:45:38 +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=none 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 46164C21FD5; Fri, 22 Jun 2018 12:44:25 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4C1F2C21C2C; Fri, 22 Jun 2018 12:44:21 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id B2DBDC21E74 for ; Fri, 22 Jun 2018 12:44:20 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id EA4B6AF2E; Fri, 22 Jun 2018 12:44:19 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Fri, 22 Jun 2018 14:44:14 +0200 Message-Id: <20180622124418.52892-7-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180622124418.52892-1-agraf@suse.de> References: <20180622124418.52892-1-agraf@suse.de> Cc: Heinrich Schuchardt , Andy Shevchenko Subject: [U-Boot] [PATCH v5 06/10] 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Simon Glass 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 Signed-off-by: Alexander Graf --- arch/sandbox/cpu/os.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index e3fe017b5f..3067503d51 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -143,15 +143,16 @@ 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), + hdr = mmap(NULL, length + page_size, PROT_READ | PROT_WRITE | PROT_EXEC, 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)