> 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...

>         li 0,0                        //set the GPR0 to completly to zeros
>         mr 3,0                        //why that?? since 0 OR 0 is 0 it just
>                               //moves GPR0 to GRP3, right?

Yes. MR is move register. Looks like crappy code without optims again

>         lwz 11,0(1)             //GPR3 pointing to 0?

That loads r11 with 0(r1) which is where we stored the "old" r1 in the
stackframe, so r11 gets the old stack pointer

>         lwz 0,4(11)           //GPR0 pointing to 4?

Get back LR value we saved

>         mtlr 0                        //again this mt* function what does it?

Store that value into the LR register

>         lwz 31,-4(11)           //...

Restore r31 as well

>         mr 1,11                       //..

Set back stack pointer to what it was on entry

>         blr                   //...

return

Reply via email to