Add commentary about the new "asmlinkage_protect()" macro

It's really a pretty ugly thing to need, and some day it will hopefully
be obviated by teaching gcc about the magic calling conventions for the
low-level system call code, but in the meantime we can at least add big
honking comments about why we need these insane and strange macros.

I took my comments from my version of the macro, but I ended up deciding
to just pick Roland's version of the actual code instead (with his
prettier syntax that uses vararg macros). Thus the previous two commits
that actually implement it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+24
+11
include/asm-x86/linkage.h
··· 14 14 */ 15 15 #define asmregparm __attribute__((regparm(3))) 16 16 17 + /* 18 + * Make sure the compiler doesn't do anything stupid with the 19 + * arguments on the stack - they are owned by the *caller*, not 20 + * the callee. This just fools gcc into not spilling into them, 21 + * and keeps it from doing tailcall recursion and/or using the 22 + * stack slots for temporaries, since they are live and "used" 23 + * all the way to the end of the function. 24 + * 25 + * NOTE! On x86-64, all the arguments are in registers, so this 26 + * only matters on a 32-bit kernel. 27 + */ 17 28 #define asmlinkage_protect(n, ret, args...) \ 18 29 __asmlinkage_protect##n(ret, ##args) 19 30 #define __asmlinkage_protect_n(ret, args...) \
+13
include/linux/linkage.h
··· 17 17 # define asmregparm 18 18 #endif 19 19 20 + /* 21 + * This is used by architectures to keep arguments on the stack 22 + * untouched by the compiler by keeping them live until the end. 23 + * The argument stack may be owned by the assembly-language 24 + * caller, not the callee, and gcc doesn't always understand 25 + * that. 26 + * 27 + * We have the return value, and a maximum of six arguments. 28 + * 29 + * This should always be followed by a "return ret" for the 30 + * protection to work (ie no more work that the compiler might 31 + * end up needing stack temporaries for). 32 + */ 20 33 #ifndef asmlinkage_protect 21 34 # define asmlinkage_protect(n, ret, args...) do { } while (0) 22 35 #endif