求助!linux添加系统调用,统计系统缺页总次数和当前进程的缺页次数

junecesty2 2014-12-31 11:28:01
我别的部分都已经改好了,但就是sys.c里不知道怎么写,前面
unistd.h里为:
#define__NR_mysyscall 223
__SYSCALL(__NR_mysyscall,sys_mysyscall)

syscall_32.tbl
223 i386 mysyscall

在include/linux/mm.h里申明了变量pfcount
在sched.h里的task_struct中写了unsigned long pf;
将kernel/fork.c中的dup task struct函数里的pf设为了0:
static struct task_struct *dup_task_struct(struct task_struct *orig)
{
……
tsk=alloc_task_struct_node(node);
if(!tsk)
return NULL;
tsk->pf=0;
……
}
在arch/x86/mm/fault.c里
定义unsighed long pfcount;
在do_page_fault里写了
pfcount++;
current->pf++
就是mysyscall的实现这一部分(输出)不会写 求帮忙!拜托了!


...全文
1355 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
fohoo 2018-12-18
  • 打赏
  • 举报
回复
看看时间,晕了
HanryCat 2018-12-14
  • 打赏
  • 举报
回复
syscall(223);

4,441

社区成员

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

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