On 16.11.2013 14:00, Leif Lindholm wrote:
> On Sat, Nov 16, 2013 at 01:49:51PM +0100, Vladimir 'φ-coder/phcoder' 
> Serbinenko wrote:
>> On 16.11.2013 13:39, Leif Lindholm wrote:
>>> -   str     r9, transition_space + 8
>> You need to save r9. Otherwise GRUB will crash if compiled with clang.
> 
> Hmm, but this is a bug in clang in that case.
> 
> From an ABI perspective, grub_uboot_syscall is a veneer:
> the only visible side effect it is permitted to have is to corrupt r12.
> 
According to wikipedia:
"Subroutines must preserve the contents of r4 to r11 and the stack pointer."
So changing r9 sounds to me like this is actually U-Boot bug and
preserving it sounds like right way to handle it.
What's the harm in preserving r9? Is it used for something in calling?
> We need to additionally switch r8 between grub and u-boot copy because
> u-boot uses it for its global data pointer, and lr because we need to
> corrupt it to make u-boot return to this veneer to switch the r8 back
> again.
> 
> This veneer should not touch anything else - so if we need to
> temporarily work around a toolchain ABI bug, can we do this via an
> ifdef and a config option?
> 
If the bug is on clang side (I doubt it right now), there is no way to
handle it without side effects and we can invent a test for it, we can
reject buggy compilers (clang is secondary compiler)
> /
>     Leif
> 
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
> 


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to