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

asm volatile



Hi, I just start to learn Linux kernel programming. Does any of you know
what "asm volatile" or "__asm__ __volatile__" is? It seems like it is
telling the compiler to convert the code into assembly code, but what
does it exactly do? Here is an example:

  asm volatile("lock; cmpxchgl %1,%2"
                  :"=a" (newcount)
                  :"r" (newcount), "m" (atomic->counter), "" (counter));

This is from atomic_dec_and_lock(). Thanks.


Po Ki


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/