On Wed, Jun 25, 2003 at 04:02:13PM +0200, Benjamin Herrenschmidt wrote: > > main: > > stwu 1,-32(1) //I do not understand this. > > mflr 0 //Does this > > stw 31,28(1) //setup some > > stw 0,36(1) //GPRs for the > > mr 31,1 //begin of the code?? > > The stwu will do r1=r1-32 and store old r1 there (stack pointer). This > will basically sets up the stackframe for the function. The LR is backed > up in r0 (the return address) and stored in the stackframe. r31 is a > non-volatile register, since the compiler thinks it will need it, it > backs it up > (though the reason it uses it is unclear, looks like lack of > optimisations). Finally, it bask up r1 (stack pointer) to r31, I'm not > sure why at this point. > > > lis 9,[EMAIL PROTECTED] //this is > > la 3,[EMAIL PROTECTED](9) //fine > > crxor 6,6,6 //this clears the contend of crb6 right? > > bl printf //mhh.. > > Well... calls printf with your string ;) I'm not sure what's up with the > crxor, sounds useless...
It is specified in the ABI for functions with variable number of argumentsi: the crxor indicates that no parameters have been passed in the floating point registers so an integer only task will not save fpr1-fpr8 to walk the argument list in va_arg. OTOH if you call a variadic functions with floating point parameters, the call will be preceded by creqv 6,6,6. Note that this convention is also used in the kernel, so every printk call is preceded by a useless crxor. All of this because the 32 bit PPC ABI for variadic functions seems to be designed to make life more difficult^Winteresting, especially for compiler writers. Regards, Gabriel