From af61b50c1077b6d936c8ed741c1d0b8e43eb2b19 Mon Sep 17 00:00:00 2001 From: Harrison Mutai Date: Thu, 12 Dec 2024 18:33:54 +0000 Subject: [PATCH] fix(aarch32): avoid using r12 to store boot params The current implementation uses the `r12` register as temporary storage for r4. However, `r12` is a call-clobbered register, meaning its contents are not preserved across function calls. This becomes problematic when we later call the `zeromem` function, as any information stored in `r12` will be lost. To address this issue, we should avoid using `r12` to store boot parameters. Change-Id: If94b7fc3a01bc617ceadaaa704d5aa5e5accfd3f Signed-off-by: Harrison Mutai --- bl2/aarch32/bl2_entrypoint.S | 18 +++++++++--------- changelog.yaml | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/bl2/aarch32/bl2_entrypoint.S b/bl2/aarch32/bl2_entrypoint.S index 678d9c2f0..91fc682e6 100644 --- a/bl2/aarch32/bl2_entrypoint.S +++ b/bl2/aarch32/bl2_entrypoint.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2022, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2024, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -29,10 +29,10 @@ func bl2_entrypoint * use. * --------------------------------------------- */ - mov r9, r0 - mov r10, r1 - mov r11, r2 - mov r12, r3 + mov r8, r0 + mov r9, r1 + mov r10, r2 + mov r11, r3 /* --------------------------------------------- * Set the exception vector to something sane. @@ -114,10 +114,10 @@ func bl2_entrypoint * Perform BL2 setup * --------------------------------------------- */ - mov r0, r9 - mov r1, r10 - mov r2, r11 - mov r3, r12 + mov r0, r8 + mov r1, r9 + mov r2, r10 + mov r3, r11 bl bl2_setup diff --git a/changelog.yaml b/changelog.yaml index 422b9dafe..36ba4ea6f 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -1273,6 +1273,9 @@ subsections: - title: AArch64 scope: aarch64 + - title: AArch32 + scope: aarch32 + - title: Debug scope: debug