系统的实施调用Linux内核源代码内/陷阱 [英] Implementation of system calls / traps within Linux kernel source

查看:193
本文介绍了系统的实施调用Linux内核源代码内/陷阱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在学习操作系统的使用陷阱,以方便系统在Linux内核中调用。我已经位于traps.c陷阱的桌子和许多陷阱内entry.S中的实施。

I'm currently learning about operating systems the use of traps to facilitate system calls within the Linux kernel. I've located the table of the traps in traps.c and the implementation of many of the traps within entry.S.

不过,我奉命找到在Linux内核两个系统调用它利用陷阱来实现系统调用的实现。虽然我可以找到自己的陷阱的定义,我不知道什么是呼地内核中的这些陷阱会是什么样子之一。因此,我苦苦寻找的这种行为的例子。

However, I'm instructed to find an implementation of two system calls in the Linux kernel which utilize traps to implement a system call. Although I can find the definition of the traps themselves, I'm not sure what a "call" to one of these traps within the kernel would look like. Therefore, I'm struggling to find an example of this behavior.

在有人问,没错,这就是家庭作业。

Before anyone asks, yes, this is homework.

作为一个说明,我使用Github上浏览内核源代码,因为kernel.org下跌:
https://github.com/torvalds/linux/

As a note, I'm using Github to browse the kernel source, since kernel.org is down: https://github.com/torvalds/linux/

推荐答案

有关x86架构的SYCALL_VECTOR(0x80的)中断使用的仅适用于32位内核。你可以看到在弓/ 86 /有/ ASM / irq_vectors.h 中断向量布局。在 trap_init() traps.c 函数是套在 entry_32.S :

For the x86 architecture the SYCALL_VECTOR (0x80) interrupt is used only for 32bit kernels. You can see the interrupt vector layout in arch/x86/include/asm/irq_vectors.h. The trap_init() function from traps.c is the one that sets the trap handler defined in entry_32.S:

set_system_trap_gate(SYSCALL_VECTOR,&安培; system_call的);

有关在 64位内核,新的 SYSENTER 的(英特尔)或 SYSCALL 的(AMD)说明资讯用于性能方面的原因。在 syscall_init()函数弓/ 86 /内核/ CPU / common.c中设置了处理程序规定在 entry_64.S 和轴承相同的名称( system_call的的)。

For the 64bit kernels, the new SYSENTER (Intel) or SYSCALL (AMD) intructions are used for performance reasons. The syscall_init() function from arch/x86/kernel/cpu/common.c sets up the "handler" defined in entry_64.S and bearing the same name (system_call).

有关用户空间perspetive你可能想看看此页面(有点过时的功能/文件名)。

For the user-space perspetive you might want to take a look at this page (a bit outdated for the function/file names).

这篇关于系统的实施调用Linux内核源代码内/陷阱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆