linux内核中开头带有 asmlinkage 的函数表示什么
强制通过堆栈传递参数,不要用寄存器传递
仔细看一下有asmlinkage的地方通常是系统调用的函数,因为在系统调用中,寄存器从用户空间传过来后SAVE_ALL压入堆栈,接着调用相应的系统调用函数,这样系统调用函数一定要保证是通过堆栈传递参数的
转贴一段:
The asmlinkage tag is one other thing that we should observe about this simple function. 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. And, because you'll be seeing asmlinkage in front of many other functions, I thought you should know what it was about.
相关文档:
前提:linux在虚拟机上,暂不知道不在虚拟机上情况是怎样的。使用host-only联网。
1.安装serv-u
2.linux上设置ip,使之与window上Vmnet1连接的ip在一个网段。原因可能是,win上的Vmnet1相当于主机(192.168.1.1)。
vi /etc/sysconfig/network-scripts/ifcfg-eth0 :
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
IPADDR ......
Linux系统都是以文件的形式来访问硬件设备的,各种设备是以系统设备文件的形式存在于系统设备目录/dev中的。这些文件用于访问系统中所有不同类型的硬件。例如,/dev/mouse文件对应鼠标设备文件,用于读取鼠标输入的;/dev/fd0文件对应软驱设备文件,用于处理软盘读写的;
Linux文件系统中每个文件用 i节点 来标识,关 ......
怎样创建真正很小的Linux下的ELF可执行文件
转载: ELF文件格式研究
日期: Friday, July 25 @ 14:46:16 CST
主题: 软件开发
发信人: someone (++), 信区: Linux
标 题: 怎样创建真正很小的Linux下的ELF可执行文件
发信站: ......