2.6 Cores
1> Change the linux-source-2.6.31/kernel/sys.c file, add the system response function at the end of the file. Function implementations such as the following:asmlinkage int Sys_mycall (int number) {
PRINTK ("This is the first system call I joined");
return number;
}
2> in linux-source-2.6.31/arch/x86/kernel/syscall_table_32.s add:. Long Sys_mycallsuch as:. Long Sys_mycall/* 341 */
3> joined in the Linux-2.6.31/arch/x86/include/asm/unistd_32.hsuch as:#define __nr_mycall Sequence Number (for example, 341), enter the entry parameters of the system call (note: The ordinal number of the entry is defined in order.) The added number is based on the original maximum value of +1)
4> once again, you can configure the compiler kernel to
latest 3. X Core
1> inAdd a new system call function at the end of the linux-3.8.4/kernel/sys.c filesuch as:asmlinkage int Sys_mycall (int number) {
PRINTK ("This is the first system call I joined");
return number;
}2> found unused number No. 223 in ARCH/X86/SYSCALL_32.TBL and replaced it with the following:223 i386 mycallsys_mycall
once again, the 3> compiles to
There is also a method, because the 64-bit operating system is compatible with 32-bit, the following use 64-bit case
1> The first step with the above
2> found system call number No. 313 under ARCH/X86/SYSCALLS/SYSCALL_64.TBL. And then add the number No. 314 to its own interrupt below.such as:314 common mycallsys_mycall once again, the 3> compiles to
Transfer from www.360doc.com/content/13/0502/16/12139495_282464589.html
Adding system calls to the Linux kernel compare the old and new kernels