linux arch/arm64 添加系统调用

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);

posted @ 2018-02-12 11:29  yuchaodu  阅读(1074)  评论(0)    收藏  举报