■2.6内核的两个宏常量“nr_syscalls”和“NR_syscalls”?

HiderDick 2006-02-18 08:16:36
我想在2.6内核中添加系统调用,于是查询了网上的相关文档。不过这个版本的内核中,sys_call_table被从entry.S中提了出来,单独放在了文件syscall_table.S中。因此当我相继在entry.S中发现了宏定义“#define nr_syscalls ((syscall_table_size)/4)”以及在unistd.h中发现了宏定义“#define NR_syscalls 294”后,我就无法确定新内核下添加系统调用是否与前期版本基本相同,这两个宏定义到底各是做什么的呢?
...全文
259 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
sourceid 2006-02-23
  • 打赏
  • 举报
回复
个人理解:
当前表的地址减去表的开始地址.

The following statements excerpt from as mamual:

The special symbol `.' refers to the current address that as is assembling into.
Thus, the expression `melvin: .long .' defines melvin to contain its own address.
Assigning a value to . is treated the same as a .org directive. Thus, the expression `.=.+4'
is the same as saying `.space 4'.
HiderDick 2006-02-21
  • 打赏
  • 举报
回复
我在entry.S的最后找到了:
syscall_table_size=(.-sys_call_table)
这是什么语法?
那这样的话我在sys_call_table里做了添加是不是syscall_table_size也会随之改变?
sourceid 2006-02-20
  • 打赏
  • 举报
回复
一样。
sys_call_table它每个系统调用的size是.long,即4byte.
HiderDick 2006-02-19
  • 打赏
  • 举报
回复
那nr_syscalls呢?
sourceid 2006-02-19
  • 打赏
  • 举报
回复
NR_syscalls 系统调用总数。

4,436

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧