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.

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

Reply via email to