Hi
Arguments between the BL1 and BL2 is overlap by zeromem when BL2 start.
1. BL2 save r3 to r12 arm-trusted-firmware/bl2/aarch32/bl2_entrypoint.S /*--------------------------------------------- * Save arguments x0 - x3 from BL1 for future * use. * --------------------------------------------- */ mov r9, r0 mov r10, r1 mov r11, r2 mov r12, r3
2. BL2 call zeromem to clear bss arm-trusted-firmware/bl2/aarch32/bl2_entrypoint.S ldr r0, =__BSS_START__ ldr r1, =__BSS_END__ sub r1, r1, r0 bl zeromem
arm-trusted-firmware/lib/aarch32/misc_helpers.S tmp .req r12 /* Temporary scratch register */ r12 used as scratch register
3. r3 restore from r12 arm-trusted-firmware/bl2/aarch32/bl2_entrypoint.S mov r0, r9 mov r1, r10 mov r2, r11 mov r3, r12
I can try to save it in other registers, but can not guarantee that the register will not be damaged. Is there any better way to deal with this problem? Thanks.
Hi,
This issue looks related to the following ticket: https://developer.trustedfirmware.org/T661
It was corrected for argument passing from BL2 to BL32, in aarch32 mode, see patch: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/3518
Could you try the same change in bl2/aarch32/bl2_entrypoint.S? And if it is OK for you, propose the patch?
You can check the following page for how to contribute:
https://trustedfirmware-a.readthedocs.io/en/latest/process/contributing.html
Best regards, Yann
On 5/15/22 10:57, 邬金平 via TF-A wrote:
Hi
Arguments between the BL1 and BL2 is overlap by zeromem when BL2 start.
- BL2 save r3 to r12
arm-trusted-firmware/bl2/aarch32/bl2_entrypoint.S /*--------------------------------------------- * Save arguments x0 - x3 from BL1 for future * use. * --------------------------------------------- */ mov r9, r0 mov r10, r1 mov r11, r2 mov r12, r3
- BL2 call zeromem to clear bss
arm-trusted-firmware/bl2/aarch32/bl2_entrypoint.S ldr r0, =__BSS_START__ ldr r1, =__BSS_END__ sub r1, r1, r0 bl zeromem
arm-trusted-firmware/lib/aarch32/misc_helpers.S tmp .req r12 /* Temporary scratch register */ r12 used as scratch register
- r3 restore from r12
arm-trusted-firmware/bl2/aarch32/bl2_entrypoint.S mov r0, r9 mov r1, r10 mov r2, r11 mov r3, r12
I can try to save it in other registers, but can not guarantee that the register will not be damaged. Is there any better way to deal with this problem? Thanks.
tf-a@lists.trustedfirmware.org