[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: asm volatile
On Sun, Mar 16, 2003 at 01:52:52PM -0500, Po Ki Chui wrote:
> 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:
The following quote is from "info gcc" -- which I strongly recommend
reading any time you can't figure out what some piece of kernel source
does. (Well, I _hate_ the info format, and the info reader more, but
emacs users might find it rather at home. And other people find pinfo
more reasonable.)
You can prevent an `asm' instruction from being deleted, moved
significantly, or combined, by writing the keyword `volatile' after
the `asm'. For example:
Cheers!
--
"It's just PR. They repeat "small government" enough, and people start
to look past the facts." -- Matt B
PGP signature