[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Inline assembly syntax in gcc...

Hi all,

Can anyone point out the way inline assembly is used in gcc? In particular
I am confused about the following kind of code in the kernel.

    asm volatile ("movl  %%cr4, %0\n\t"
              "movl  %0, %1\n\t"
              "andb  $0x7f, %b1\n\t"
              "movl  %1, %%cr4\n\t"
              : "=r" (ctxt->cr4val), "=q" (tmp) : : "memory");

OR like this....

    asm volatile ("movl  %%cr0, %0\n\t"
          "orl   $0x40000000, %0\n\t"
          "movl  %0, %%cr0\n\t"
          : "=r" (tmp) : : "memory");

I am particularly confused about the colons and the "=r" and stuff like


Kedar N. Patankar.
Senior Software Engineer.
ishoni Networks
...Broadband for everyone
email - kedar@xxxxxxxxxx
Phone: +91-80-2292125 (Work)
Fax: +91-80-2995545 (Work)
Don't worry over what other people are thinking about you.
They're too busy worrying over what you are thinking about them.