I'll describe on Linux Kernel 2.6.32.

We'll edit 3 Files.

1. unistd_64.h
2. syscalls.h
3. Makefile

And, Write a 1 File
1. function.c

First. Open unistd_64.h by vim
1. vi /usr/src/linux-2.6.32/arch/x86/include/asm/unistd_64.h
2. Add 2 information
    #define __NR_new_syscall      ???
    __SYSCALL(__NR_get_cpu_num, sys_newcall)




Second, Edit Syscalls.h
1. vi /usr/src/linux-2.6.32/include/linux/syscalls.h
2. Add a Function.
   asmlinkage long sys_newcall(int n)



Third, Make function.c
1. vi /usr/src/linux-2.6.32/kernel/test_syscall.c
2. And, write a function.



Last, Edit kernel/Makefile

1. vi /usr/src/linux-2.6.32/kernel/Makefile
2. add test_syscall.o





Ok, Finish.

And, make; make modules; make modules_install; make install;

Have a Fun Time.



Append ==========================

Use a new system call


+ Recent posts