[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

some basic problems with ppc assembler



Hi,

I try to understand some ppc-assembler-code but it is harder than
x86 to me because of the missing documentation. I have a big reference
from ibm here. And some websites which deal with this topic.

So I experiment now with the assembler code of c programms translated
with gcc -S file.c

For a simple Hello World programm I get lots of instructions in
assembler, used in a way, that I can not comprehend them using the ibm
reference.
Maybe someone can point me to a tutorial or if somebody has too much
time it would be nice if you comment the following shortened code out
of the c-helloworld.



.LC0:				//I guess this means .LC0 
        .string "Hello World"   //is a global string
        .globl main		//within the main label. 

        .type   main, @function //whats that for?
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??
       
        lis 9,.LC0@ha           //this is
        la 3,.LC0@l(9)		//fine
        crxor 6,6,6		//this clears the contend of crb6 right?
        bl printf		//mhh..

        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?

        lwz 11,0(1)             //GPR3 pointing to 0?
        lwz 0,4(11)		//GPR0 pointing to 4?
        mtlr 0			//again this mt* function what does it?
        lwz 31,-4(11)           //...
        mr 1,11			//..
        blr			//...

TIA

olliwolli

P.S.: I hope this is not totally off topic in this list





Reply to: