Commit 76d84cbc authored by Madhukar Pappireddy's avatar Madhukar Pappireddy
Browse files

Changes necessary to support SEPARATE_NOBITS_REGION feature



Since BL31 PROGBITS and BL31 NOBITS sections are going to be
in non-adjacent memory regions, potentially far from each other,
some fixes are needed to support it completely.

1. adr instruction only allows computing the effective address
of a location only within 1MB range of the PC. However, adrp
instruction together with an add permits position independent
address of any location with 4GB range of PC.

2. Since BL31 _RW_END_ marks the end of BL31 image, care must be
taken that it is aligned to page size since we map this memory
region in BL31 using xlat_v2 lib utils which mandate alignment of
image size to page granularity.

Change-Id: Ic745c5a130fe4239fa2742142d083b2bdc4e8b85
Signed-off-by: default avatarMadhukar Pappireddy <madhukar.pappireddy@arm.com>
parent d81e38f6
/* /*
* Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -110,13 +110,17 @@ func bl31_entrypoint ...@@ -110,13 +110,17 @@ func bl31_entrypoint
* caches and participate in coherency. * caches and participate in coherency.
* -------------------------------------------------------------------- * --------------------------------------------------------------------
*/ */
adr x0, __DATA_START__ adrp x0, __DATA_START__
adr x1, __DATA_END__ add x0, x0, :lo12:__DATA_START__
adrp x1, __DATA_END__
add x1, x1, :lo12:__DATA_END__
sub x1, x1, x0 sub x1, x1, x0
bl clean_dcache_range bl clean_dcache_range
adr x0, __BSS_START__ adrp x0, __BSS_START__
adr x1, __BSS_END__ add x0, x0, :lo12:__BSS_START__
adrp x1, __BSS_END__
add x1, x1, :lo12:__BSS_END__
sub x1, x1, x0 sub x1, x1, x0
bl clean_dcache_range bl clean_dcache_range
......
/* /*
* Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -414,7 +414,8 @@ smc_handler64: ...@@ -414,7 +414,8 @@ smc_handler64:
orr x16, x16, x15, lsl #FUNCID_OEN_WIDTH orr x16, x16, x15, lsl #FUNCID_OEN_WIDTH
/* Load descriptor index from array of indices */ /* Load descriptor index from array of indices */
adr x14, rt_svc_descs_indices adrp x14, rt_svc_descs_indices
add x14, x14, :lo12:rt_svc_descs_indices
ldrb w15, [x14, x16] ldrb w15, [x14, x16]
/* Any index greater than 127 is invalid. Check bit 7. */ /* Any index greater than 127 is invalid. Check bit 7. */
......
/* /*
* Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -208,6 +208,7 @@ SECTIONS ...@@ -208,6 +208,7 @@ SECTIONS
* Define a linker symbol to mark end of the RW memory area for this * Define a linker symbol to mark end of the RW memory area for this
* image. * image.
*/ */
. = ALIGN(PAGE_SIZE);
__RW_END__ = .; __RW_END__ = .;
__BL31_END__ = .; __BL31_END__ = .;
......
/* /*
* Copyright (c) 2014-2016, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2014-2020, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -41,7 +41,8 @@ endfunc init_cpu_data_ptr ...@@ -41,7 +41,8 @@ endfunc init_cpu_data_ptr
func _cpu_data_by_index func _cpu_data_by_index
mov_imm x1, CPU_DATA_SIZE mov_imm x1, CPU_DATA_SIZE
mul x0, x0, x1 mul x0, x0, x1
adr x1, percpu_data adrp x1, percpu_data
add x1, x1, :lo12:percpu_data
add x0, x0, x1 add x0, x0, x1
ret ret
endfunc _cpu_data_by_index endfunc _cpu_data_by_index
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment