【问题标题】:How to implement a simple system call in kernel 2.6.26?如何在内核 2.6.26 中实现一个简单的系统调用?
【发布时间】:2012-10-25 16:00:00
【问题描述】:

我在这里遇到了很多问题,在其他网站上我仍然有以下问题。

我正在实现一个简单的系统调用,为此我更改了如下文件

 1. /arch/x86/kernel/syscal_table_32_S
 2. /include/asm-x86/unistd_32.h
 3. /include/linux/syscalls.h

我对第二个文件有疑问,因为我不确定这个文件(/include/asm-x86/unistd_32.h)要修改还是任何其他文件,因为我知道包含系统调用号的文件,我们必须添加我们的系统调用和最后一个数字+ 1,这里的疑问是这个文件(/include/asm-x86/unistd_32.h)不包含限制线(#define NR_syscalls <last syscall no + 1>)但是还有另一个文件(/include/asm-sh/unistd_32.h),其中包含系统调用号和限制线。

那么,请用一个简单的例子告诉我要修改哪些文件。

【问题讨论】:

    标签: linux-kernel system-calls


    【解决方案1】:

    我在 linux-kernel 3.2 上实现了新的系统调用并修改了以下文件:

    1. /arch/x86/kernel/syscal_table_32.S
    2. /arch/x86/kernel/syscal_table_64.S
    3. /arch/x86/include/asm/unistd_32.h - contains NR_syscalls for ia32
    4. /arch/x86/include/asm/unistd_64.h
    5. /arch/x86/include/asm/<new_file_with_syscall>
    6. /arch/x86/include/asm/Makefile
    

    我使用syscall(NUMBER_OF_SYSCALL) 函数调用的系统调用本身。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-20
      • 2011-06-10
      • 1970-01-01
      • 2011-12-15
      • 2011-11-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多