[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/arm: linker: The identitymap check should cover the whole .text.header
commit 229ebd517b9df0e2d2f9e3ea50b57ca716334826 Author: Julien Grall <jgrall@xxxxxxxxxx> AuthorDate: Thu Jan 12 22:07:42 2023 +0000 Commit: Julien Grall <julien@xxxxxxx> CommitDate: Thu Jan 12 22:09:33 2023 +0000 xen/arm: linker: The identitymap check should cover the whole .text.header At the moment, we are only checking that only some part of .text.header is part of the identity mapping. However, this doesn't take into account the literal pool which will be located at the end of the section. While we could try to avoid using a literal pool, in the near future we will also want to use an identity mapping for switch_ttbr(). Not everything in .text.header requires to be part of the identity mapping. But it is below a page size (i.e. 4KB) so take a shortcut and check that .text.header is smaller than a page size. With that _end_boot can be removed as it is now unused. Take the opportunity to avoid assuming that a page size is always 4KB in the error message and comment. Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> --- xen/arch/arm/arm32/head.S | 2 -- xen/arch/arm/arm64/head.S | 2 -- xen/arch/arm/xen.lds.S | 10 +++++++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index a558c2a687..5c10447103 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -659,8 +659,6 @@ fail: PRINT("- Boot failed -\r\n") b 1b ENDPROC(fail) -GLOBAL(_end_boot) - /* * Switch TTBR * r1:r0 ttbr diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index ad014716db..4a3f87117c 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -811,8 +811,6 @@ fail: PRINT("- Boot failed -\r\n") b 1b ENDPROC(fail) -GLOBAL(_end_boot) - /* * Switch TTBR * diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index ae8c3b4c6c..3f7ebd19f3 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -32,7 +32,9 @@ SECTIONS _start = .; .text : { _stext = .; /* Text section */ + _idmap_start = .; *(.text.header) + _idmap_end = .; *(.text.cold) *(.text.unlikely .text.*_unlikely .text.unlikely.*) @@ -225,10 +227,12 @@ SECTIONS } /* - * 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. + * We require that Xen is loaded at a page boundary, so this ensures that any + * code running on the identity map cannot cross a section boundary. */ -ASSERT( _end_boot - start <= PAGE_SIZE, "Boot code is larger than 4K") +ASSERT(IS_ALIGNED(_idmap_start, PAGE_SIZE), "_idmap_start should be page-aligned") +ASSERT(_idmap_end - _idmap_start <= PAGE_SIZE, "Identity mapped code is larger than a page size") + /* * __init_[begin|end] MUST be at word size boundary otherwise we cannot * write fault instructions in the space properly. -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |