asm and functions with __attribute__((naked))

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

 



According to the docs (http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#index-function-without-a-prologue_002fepilogue-code-2906):

"The only statements that can be safely included in naked functions are |asm| statements that do not have operands."

My reading of this was that "naked" didn't support "extended asm" (ie the one that uses colons), only basic asm (the one that can be used outside of functions). However, then I saw this bit from the linux kernel:

http://lxr.free-electrons.com/source/arch/arm/kernel/kprobes.c#L377

which uses the "memory" clobber. My next assumption was that you just couldn't use actual input or output params. But then I saw this (among other places):

http://lxr.free-electrons.com/source/arch/arm/mm/copypage-feroceon.c#L17

which uses 3 input params.

Now I'm not sure what to think. Is the linux kernel doing something unsupported/risky? Or are the docs here just wrong?

dw




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux