diff --git a/bl2/aarch32/bl2_entrypoint.S b/bl2/aarch32/bl2_entrypoint.S index 102fd2f5143c9337c2b65633c54a224ef7cec181..6e8e2c1e1a6465c493f6054a0d4eb0ae50f956e2 100644 --- a/bl2/aarch32/bl2_entrypoint.S +++ b/bl2/aarch32/bl2_entrypoint.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2021, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -80,12 +80,14 @@ func bl2_entrypoint * --------------------------------------------- */ ldr r0, =__BSS_START__ - ldr r1, =__BSS_SIZE__ + ldr r1, =__BSS_END__ + sub r1, r1, r0 bl zeromem #if USE_COHERENT_MEM ldr r0, =__COHERENT_RAM_START__ - ldr r1, =__COHERENT_RAM_UNALIGNED_SIZE__ + ldr r1, =__COHERENT_RAM_END_UNALIGNED__ + sub r1, r1, r0 bl zeromem #endif diff --git a/bl2u/aarch32/bl2u_entrypoint.S b/bl2u/aarch32/bl2u_entrypoint.S index 6391f537cd2cafb4462efce603c111caa508f8e9..e4dd03dece25dc17c2e3c2b3b4920f2e3796f10b 100644 --- a/bl2u/aarch32/bl2u_entrypoint.S +++ b/bl2u/aarch32/bl2u_entrypoint.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2021, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -79,7 +79,8 @@ func bl2u_entrypoint * --------------------------------------------- */ ldr r0, =__BSS_START__ - ldr r1, =__BSS_SIZE__ + ldr r1, =__BSS_END__ + sub r1, r1, r0 bl zeromem /* -------------------------------------------- diff --git a/bl2u/aarch64/bl2u_entrypoint.S b/bl2u/aarch64/bl2u_entrypoint.S index 3e37b44f7d43868163e97c1535f5c38c0c1386c7..15978b6d41b19b75ed77603cad95ef1e5e7d4fd8 100644 --- a/bl2u/aarch64/bl2u_entrypoint.S +++ b/bl2u/aarch64/bl2u_entrypoint.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2021, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -69,8 +69,11 @@ func bl2u_entrypoint * - the coherent memory section. * --------------------------------------------- */ - ldr x0, =__BSS_START__ - ldr x1, =__BSS_SIZE__ + adrp x0, __BSS_START__ + add x0, x0, :lo12:__BSS_START__ + adrp x1, __BSS_END__ + add x1, x1, :lo12:__BSS_END__ + sub x1, x1, x0 bl zeromem /* -------------------------------------------- diff --git a/bl32/tsp/aarch64/tsp_entrypoint.S b/bl32/tsp/aarch64/tsp_entrypoint.S index a007bab30240322782d45986a6f687198ada048a..795c5865e1e62a3908f985d8e419e1d405dcb400 100644 --- a/bl32/tsp/aarch64/tsp_entrypoint.S +++ b/bl32/tsp/aarch64/tsp_entrypoint.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2021, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -114,13 +114,19 @@ func tsp_entrypoint _align=3 * - the coherent memory section. * --------------------------------------------- */ - ldr x0, =__BSS_START__ - ldr x1, =__BSS_SIZE__ + adrp x0, __BSS_START__ + add x0, x0, :lo12:__BSS_START__ + adrp x1, __BSS_END__ + add x1, x1, :lo12:__BSS_END__ + sub x1, x1, x0 bl zeromem #if USE_COHERENT_MEM - ldr x0, =__COHERENT_RAM_START__ - ldr x1, =__COHERENT_RAM_UNALIGNED_SIZE__ + adrp x0, __COHERENT_RAM_START__ + add x0, x0, :lo12:__COHERENT_RAM_START__ + adrp x1, __COHERENT_RAM_END_UNALIGNED__ + add x1, x1, :lo12:__COHERENT_RAM_END_UNALIGNED__ + sub x1, x1, x0 bl zeromem #endif diff --git a/include/arch/aarch32/el3_common_macros.S b/include/arch/aarch32/el3_common_macros.S index 580dd95b73f0b21c1aef0ecf29ccceaaf98e224a..6caebf827224df768a2b348f3b1a143cac5b0462 100644 --- a/include/arch/aarch32/el3_common_macros.S +++ b/include/arch/aarch32/el3_common_macros.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2020, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2021, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -339,12 +339,14 @@ */ mov r7, r12 ldr r0, =__BSS_START__ - ldr r1, =__BSS_SIZE__ + ldr r1, =__BSS_END__ + sub r1, r1, r0 bl zeromem #if USE_COHERENT_MEM ldr r0, =__COHERENT_RAM_START__ - ldr r1, =__COHERENT_RAM_UNALIGNED_SIZE__ + ldr r1, =__COHERENT_RAM_END_UNALIGNED__ + sub r1, r1, r0 bl zeromem #endif @@ -358,7 +360,8 @@ */ ldr r0, =__DATA_RAM_START__ ldr r1, =__DATA_ROM_START__ - ldr r2, =__DATA_SIZE__ + ldr r2, =__DATA_RAM_END__ + sub r2, r2, r0 bl memcpy4 #endif .endif /* _init_c_runtime */