On 12/10/2020 10:22, Biju Das wrote:
Hi Biju,
Subject: Re: commit 75fab6496e5fce9a11 ("libc: memset: improve performance by avoiding single byte writes") causing BL31 boot failure on Renesas RZ/G2 platforms.
On 11/10/2020 19:23, Biju Das wrote:
Hi Biju,
Found the root cause, the new changes corrupting the registers used by
console.S.
So I have fixed the issue. Please find the attached patch.
Good find for the source of the register corruption, but unfortunately this patch won't cut it:
- I am not sure you are actually allowed to call a C function from this context. I
need to check back with the team tomorrow to find the reason these console_*_register functions are all in assembly. I don't see any assembly callers, but there is (was?) surely a reason behind this. I think this was meant to be called either early in the game (before we have a SP), or during a crash, again with no C context.
- Since this function is called *from* C, you need to adhere to the
AAPCS(64) standard, which means your function must preserve x19-x28. So you would need to save x24 and x25 to the stack. If we have one already at this point (see above).
May be we could call "rcar_log_init" from "c" file, ie, just after the " rcar_console_runtime_init()" instead of assembly? https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/plat/rene...
I would just try to move console_rcar_init() from the assembly file up to its caller, and implement it there, in C. I don't see it being called from assembly, so that should be fine. There seem to be some issues to be solved, but that might be the better route.
Cheers, Andre