码迷,mamicode.com
首页 > 系统相关 > 详细

linux arch/arm64 添加系统调用

时间:2018-02-12 13:50:39      阅读:270      评论:0      收藏:0      [点我收藏+]

标签:struct   user   inux   fine   long   linkage   post   nbsp   cal   

1,添加一个系统调用,增加系统总调用数+1

diff in kernel/include/uapi/asm-generic/unistd.h

++ #define __NR_mysyscall 285

++ SYSCALL(__NR_mysyscall, sys_mysyscall)

     #undef __NR_syscalls

-- #define __NR_syscalls 285

++ #define __NR_syscalls 286

2,声明

diff in kernel/include/linux/syscalls.h

++ asmlinkage long sys_mysyscall(const char __user * process)

     #endif

3,实现

diff in kernel/kernel/sys.c

++ SYSCALL_DEFINE1(mysyscall, const char __user *, process)

++ {

++   struct task_struct * p=current;

++   PRINT_LOG("add syscall %s %s\n",p->comm,process);

++   return 1;

++ }

4,JNI层调用

#include <sys/syscall.h>

#define __NR_mysyscall 285

int ch=syscall(__NR_mysyscall,process);

linux arch/arm64 添加系统调用

标签:struct   user   inux   fine   long   linkage   post   nbsp   cal   

原文地址:https://www.cnblogs.com/yuchaodu/p/8444117.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!