From patchwork Mon Apr 22 16:49:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 162616 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2801497jan; Mon, 22 Apr 2019 09:51:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqw89NyUaGikpsgXu2E7D7Y2OxCGvuwEmQ/CD1mDL06El0RuBvlAz/IBtTfF5buuLt0UaFlc X-Received: by 2002:a25:e7d6:: with SMTP id e205mr16326384ybh.161.1555951888041; Mon, 22 Apr 2019 09:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555951888; cv=none; d=google.com; s=arc-20160816; b=NN/R1GGqZglH51UFicszstrvE4Y3e4lHuuEWNt9R2b3H54jFZEZ8xx0S2Jo8X7qbVm a1JckBJjcZv9E8GwzMaP1mUZzhiPMb1RpJe/29ovFur053SesHVKTO/ed+OuErG+u8nI xUyWp5n2VZOwR+3s+rp9sDlumgSG4vGTKxKx4ItzDMv4WBzlTBWn53FwbQ0LHfXjNczS 7CegwfgbU0+JZM7P8cje1+yUWBEdNlPtLn8xp+Lh9YJ3/o5tquhCaX/xnLRyfAuJsq/O hVwP4eqKn+MsQokaaZIDAC2bkhVOWPJZICpzooowsvMbMREEzZlTKeU+roYBqvuNY3Lg febA== 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:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=aHvZNhSyeR4Zg0OxcnJG/kd/zPUcdjkvKqY1dJkr9o4=; b=U6HTkq0MXunkgSS3mM1BOln2t14UJpOnFjDMsqCMtQnmbLuzmohBKEP0QdAoo0mgtg VkI84NP7tCRRwp6QreIV1uEd9cuVrbm9atM09ULsHcYt/WBbv1FHNs+X22IeznzuQQb0 Z62slpIj+KRNvyjxUf4UWO41n4NLNKgcbFX8XeusK4O6sksoTF3U6QhIY3cNerEZp07q ILnATeAexMLQjwTVO3jQ7sKBoZfT4rBLQ37oY4qX1eEe1wxJ4s0AlQr0j6bE/sigx350 7wWctiDexPYNa0cQSN3+hHbGXqbEQo8vIiJGh/11pNCIuj9F3xHBtcrqjfsZL1Ryake4 pNDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id c187si8994236ybb.370.2019.04.22.09.51.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Apr 2019 09:51:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8v-00058o-O4; Mon, 22 Apr 2019 16:50:09 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hIc8u-00054g-FK for xen-devel@lists.xenproject.org; Mon, 22 Apr 2019 16:50:08 +0000 X-Inumbo-ID: af2501c1-651e-11e9-92d7-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id af2501c1-651e-11e9-92d7-bc764e045a96; Mon, 22 Apr 2019 16:50:07 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3A0B615AB; Mon, 22 Apr 2019 09:50:07 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2A9B43F557; Mon, 22 Apr 2019 09:50:06 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 22 Apr 2019 17:49:29 +0100 Message-Id: <20190422164937.21350-13-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190422164937.21350-1-julien.grall@arm.com> References: <20190422164937.21350-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 12/20] xen/arm32: head: Always zero r3 before update a page-table entry X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The boot code is using r2 and r3 to hold the page-table entry value. While r2 is always updated before storing the value, this is not always the case for r3. Thankfully today, r3 will always be zero when we care. But this is difficult to track and error-prone. So always zero r3 within the few instructions before the write the page-table entry. Signed-off-by: Julien Grall Reviewed-by: Andrii Anisov --- xen/arch/arm/arm32/head.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index 3448817aab..0536b62aec 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -270,6 +270,7 @@ cpu_init_done: orr r2, r2, #PT_UPPER(MEM) /* r2:r3 := section map */ orr r2, r2, #PT_LOWER(MEM) lsl r1, r1, #3 /* r1 := Slot offset */ + mov r3, #0x0 strd r2, r3, [r4, r1] /* Mapping of paddr(start) */ mov r6, #1 /* r6 := identity map now in place */ @@ -377,6 +378,7 @@ paging: lsl r2, r2, #THIRD_SHIFT /* 4K aligned paddr of UART */ orr r2, r2, #PT_UPPER(DEV_L3) orr r2, r2, #PT_LOWER(DEV_L3) /* r2:r3 := 4K dev map including UART */ + mov r3, #0 strd r2, r3, [r1, #(FIXMAP_CONSOLE*8)] /* Map it in the first fixmap's slot */ 1: @@ -388,6 +390,7 @@ paging: orr r2, r2, #PT_LOWER(PT) /* r2:r3 := table map of xen_fixmap */ ldr r4, =FIXMAP_ADDR(0) mov r4, r4, lsr #(SECOND_SHIFT - 3) /* r4 := Slot for FIXMAP(0) */ + mov r3, #0 strd r2, r3, [r1, r4] /* Map it in the fixmap's slot */ /* Use a virtual address to access the UART. */