当前位置: 技术问答>linux和unix
请问"asmlinkage"关键字是什么意思
来源: 互联网 发布时间:2015-11-03
本文导语: 如题 | asmlinkage是个宏,使用它是为了保持参数在stack中。因为从汇编语言到C语言代码参数 的传递是通过stack的,它也可能从stack中得到一些不需要的参数。Asmlinkage将要 解析那些参数。 This ...
如题
|
asmlinkage是个宏,使用它是为了保持参数在stack中。因为从汇编语言到C语言代码参数
的传递是通过stack的,它也可能从stack中得到一些不需要的参数。Asmlinkage将要
解析那些参数。
This is a #define for some gcc magic that tells the compiler that the function should not expect to find any of its arguments in registers (a common optimization), but only on the CPU's stack. Recall our earlier assertion that system_call consumes its first argument, the system call number, and allows up to four more arguments that are passed along to the real system call. system_call achieves this feat simply by leaving its other arguments (which were passed to it in registers) on the stack. All system calls are marked with the asmlinkage tag, so they all look to the stack for arguments. Of course, in sys_ni_syscall's case, this doesn't make any difference, because sys_ni_syscall doesn't take any arguments, but it's an issue for most other system calls.
的传递是通过stack的,它也可能从stack中得到一些不需要的参数。Asmlinkage将要
解析那些参数。
This is a #define for some gcc magic that tells the compiler that the function should not expect to find any of its arguments in registers (a common optimization), but only on the CPU's stack. Recall our earlier assertion that system_call consumes its first argument, the system call number, and allows up to four more arguments that are passed along to the real system call. system_call achieves this feat simply by leaving its other arguments (which were passed to it in registers) on the stack. All system calls are marked with the asmlinkage tag, so they all look to the stack for arguments. Of course, in sys_ni_syscall's case, this doesn't make any difference, because sys_ni_syscall doesn't take any arguments, but it's an issue for most other system calls.