[PATCH v2 0/4] powerpc/64: syscalls in C

Nicholas Piggin npiggin at gmail.com
Fri Aug 30 08:56:18 AEST 2019


Nicholas Piggin's on August 30, 2019 1:49 am:
>> This doesn't do what you think, or what you want, or what you think you
>> want ;-)
> 
> After reading gcc docs from gcc 4 to 9, I think it does.
> 
> We want this to apply to all functions in the compilaition unit. It's
> fine to use the regs temporarily, and so it's fine for called functions
> in other units to call them (because they will be restored), and we
> don't want them restored for our caller.
> 
>> (And if you make all those regs -ffixed-* you are in for a world of hurt).
> 
> From the look of it, -ffixed would be a little bit stronger in that it
> will never allow the register to be used, wheras the global register
> variable allows it to be allocated and used elsewhere so long as its
> observable value is not affected. The latter is actually preferred 
> because it's fine for the compiler to use the regs if it wants to. It
> does not even have to use r15 register when I reference r15 variable,
> only whatever value it had.

Ah, of course that means all of them need to be inputs to the stmw
asm (which makes sense and is documented in gcc-9 doc, which is when
the compiler was allowed to allocate them for other things.

Thanks,
Nick




More information about the Linuxppc-dev mailing list