[libc-dev] [musl] Powerpc Linux 'scv' system call ABI proposal take 2

Nicholas Piggin via libc-dev libc-dev at lists.llvm.org
Fri Apr 24 20:30:01 PDT 2020

Excerpts from Rich Felker's message of April 23, 2020 12:36 pm:
> On Wed, Apr 22, 2020 at 04:18:36PM +1000, Nicholas Piggin wrote:
>> Yeah I had a bit of a play around with musl (which is very nice code I
>> must say). The powerpc64 syscall asm is missing ctr clobber by the way.  
>> Fortunately adding it doesn't change code generation for me, but it 
>> should be fixed. glibc had the same bug at one point I think (probably 
>> due to syscall ABI documentation not existing -- something now lives in 
>> linux/Documentation/powerpc/syscall64-abi.rst).
> Do you know anywhere I can read about the ctr issue, possibly the
> relevant glibc bug report? I'm not particularly familiar with ppc
> register file (at least I have to refamiliarize myself every time I
> work on this stuff) so it'd be nice to understand what's
> potentially-wrong now.

Ah I was misremembering, glibc was (and still is) actually missing cr 
clobbers from its "vsyscall", probably because it copied syscall which 
only clobbers cr0, but vsyscall clobbers cr0-1,5-7 like a normal 
function call.

musl is missing the ctr register clobber from syscalls.

powerpc has gpr0-31 GPRs, cr0-7 condition regs, and lr and ctr branch 
registers (lr is generally used for function returns, ctr for other 
indirect branches). ctr is volatile (caller saved) across C function 
calls, and sc system calls on Linux.


More information about the libc-dev mailing list