Thanks for appling me question,
I have successfully compiled my code.
I have another question: 
    1. How to set start address of a function in gcc?
I can't find it in man.
    2. How to set data alignment in gcc? I also can't
find it in man.
    3. Which GNU program can change elf file to BIN
file. I find a elfToBin program in VxWorks, it seems
to be one of a GNU program, but I don't know which
archive include this program, please tell me.


Thanks a lot.

I learn a lot in this society!

Gavin

>----------------------------------------------------<

--- Russell King - ARM Linux <[EMAIL PROTECTED]>
wrote:
> On Fri, Oct 12, 2001 at 12:48:35PM -0700, gavin li
> wrote:
> > First, thanks for your reply!
> > I have these two functions:
> > void SetCp15(unsigned int uCp15Val)
> > {
> > asm ("mcr p15, 0, %0, c1, c0, 0;" : "=r"(uCp15Val)
> :
> > );
> > }
> 
> This is wrong.  asm statements are basically:
> 
>   asm( ... code ... : ... outputs ... : ... inputs
> ... : ... corrupted ... );
> 
> "=r" means "output register" and can only appear in
> the
> "outputs" section.
> 
> "r" means "register", and should appear in the
> inputs
> section.
> 
> Therefore, your function should have been:
> 
> void SetCp15(unsigned int uCp15Val)
> {
>       asm("mcr p15, 0, %0, c1, c0, 0" : : "r"
> (uCp15Val));
> }
> 
> > unsigned int ReadCp15()
> > {
> > unsigned int x;
> > asm ("mrc p15, 0, %0, c1, c0, 0;" : "=r"(x) : );
> > return x;
> > }
> 
> This one is fine - there's no need to add a ';' at
> the end of
> the instruction, or the ':' after the outputs if you
> have
> no inputs or corrupted specifications.


__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
Please visit the above address for information on this list.

Reply via email to