Linux中异常处理程序的实际代码在哪里? [英] where does the actual code of exception handler reside in Linux?

查看:169
本文介绍了Linux中异常处理程序的实际代码在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这来自我的教科书,该书描述了处理器如何触发异常处理程序:

This is from my textbook that describes how processor trigger exception handler:

并表示:

然后处理器通过调用间接过程
来调用异常,从而触发异常。异常表,转到相应的处理程序。图8.3显示了处理器如何使用异常表来形成适当的异常处理程序的地址。异常号是异常表的索引,其起始地址包含在称为异常表基址寄存器的特殊CPU寄存器中。

The processor then triggers the exception by making an indirect procedure call, through entry k of the exception table, to the corresponding handler. Figure 8.3 shows how the processor uses the exception table to form the address of the appropriate exception handler. The exception number is an index into the exception table, whose starting address is contained in a special CPU register called the exception table base register.

所以我的问题是,在哪里异常处理程序的实际代码驻留在哪里?在内核中?异常表基寄存器又该如何处理呢?

so my question is, where does the actual code of exception handler reside ? in kernel? and what about the exception table base register, is its content an adreess in kernel?

推荐答案

这有点超出我的理解了,但我发现了这篇维基百科文章:中断描述符表。从那里报价:

This is a little out of my depth, but I found this Wikipedia article: Interrupt descriptor table. Quoting from there:


[以实模式],在8086处理器中,中断表...始终位于内存中的同一位置,范围从 0x0000 0x03ff 。在80286及更高版本上,可以更改IVT的大小和位置。 ... 保护模式 IDT可能位于物理内存中的任何位置。

[In real mode], in the 8086 processor, the interrupt table ... always resides at the same location in memory, ranging from 0x0000 to 0x03ff. On the 80286 and later, the size and locations of the IVT can be changed. ... The protected mode IDT may reside anywhere in physical memory.

无论异常表在哪里驻留,我确定它是内核保留的内存,同样,异常处理功能在内核源代码中定义;例如 traps.c 和相关。

Regardless of where the exception table resides, I'm certain that it is memory reserved by the kernel, and likewise the exception handling functions are defined in the kernel source code; e.g. traps.c and related.

其他参考资料,不仅涉及这个确切的问题,而且还超出了这个确切的问题:

Other references for further information related to but also going beyond this exact question:

https:// 0xax。 gitbooks.io/linux-insides/content/Interrupts/linux-interrupts-5.html

https://www.oreilly.com/library/view/understanding-the-linux/0596005652/ch04s05.html

http://en.tldp.org/ LDP / khg / HyperNews / get / devices / exceptions.html

注意:我假设我们在这里谈论的是x86体系结构。如Wikipedia文章所述,其他芯片架构可能相似,尤其是在概念上,但细节上也可能有所不同。

NOTE: I am assuming we are talking about the x86 architecture here. As the Wikipedia article mentions, other chip architectures are likely to be similar, especially conceptually, but are also likely to differ in the details.

这篇关于Linux中异常处理程序的实际代码在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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