From: Ian Campbell Subject: [PATCH v3 5/6] xen: arm: ensure that the boot code is <4K in size Date: Mon, 21 Jul 2014 13:59:59 +0100 Message-ID: <1405947600-26047-5-git-send-email-ian.campbell@citrix.com> References: <1405947513.25022.59.camel@kazak.uk.xensource.com> <1405947600-26047-1-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1405947600-26047-1-git-send-email-ian.campbell@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org This avoids having to deal with the 1:1 boot mapping crossing a section or page boundary. Signed-off-by: Ian Campbell Acked-by: Julien Grall --- v3: Use GLOBAL() v2: New patch #5/4 --- xen/arch/arm/arm32/head.S | 2 ++ xen/arch/arm/arm64/head.S | 2 ++ xen/arch/arm/xen.lds.S | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index afb4c6d..14b172f 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -457,6 +457,8 @@ fail: PRINT("- Boot failed -\r\n") 1: wfe b 1b +GLOBAL(_end_boot) + /* Copy Xen to new location and switch TTBR * r1:r0 ttbr * r2 source address diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 4e22374..9497ca1 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -487,6 +487,8 @@ fail: PRINT("- Boot failed -\r\n") 1: wfe b 1b +GLOBAL(_end_boot) + /* Copy Xen to new location and switch TTBR * x0 ttbr * x1 source address diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index be55dad..079e085 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -178,3 +178,9 @@ SECTIONS .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } } + +/* + * We require that Xen is loaded at a 4K boundary, so this ensures that any + * code running on the boot time identity map cannot cross a section boundary. + */ +ASSERT( _end_boot - start <= PAGE_SIZE, "Boot code is larger than 4K") -- 1.7.10.4