有人可以指出一些书籍或在线资源,它们详细解释了x86的任务管理功能吗?当发生中断或上下文切换时,我特别感兴趣的是理解x86硬件和OS(POSIX风格)之间的关系.英特尔手册非常令人困惑,我似乎无法从中获得太多.
谢谢,
-Dhruv
编辑添加您的实际答案:
保护模式软件架构
汤姆珊利
Addison-Wesley Professional(1996年3月16日)
ISBN-10:020155447X
ISBN-13:978-0201554472
googlebook,amazon
我的答案
您是否看过“了解Linux内核”第3版?它可以通过Safari获得,它可能是开始操作系统方面的好地方 – 我认为它不会给你带来任何影响 –
坚韧不拔的细节,但它是一个很好的指南,可能会将Linux内核源代码和特定于体系结构的东西放入上下文中.以下章节为您提供了内核方面要求的叙述(“发生中断或上下文切换时硬件与操作系统之间的关系”):
>第3章:流程
>第4章:中断和例外
>第7章:流程调度
了解Linux内核,第3版.
Daniel P. Bovet; Marco Cesati
出版商:O’Reilly Media,Inc.
酒吧.日期:2005年11月17日
打印ISBN-13:978-0-596-00565-8
打印ISBN-10:0-596-00565-2
Safari,Amazon
我的推荐是这样一本书,有linux源代码和intel手册以及一个完整的啤酒冰箱,你就可以开始运行了.
来自第3章:流程的简短片段,以激发您的胃口:
3.3.2. Task State Segment
The 80×86 architecture includes a specific segment type called the Task State Segment (TSS),to store hardware contexts. Although Linux doesn’t use hardware context switches,it is nonetheless forced to set up a TSS for each distinct CPU in the system. This is done for two main reasons:
- When an 80×86 CPU switches from User Mode to Kernel Mode,it fetches the address of the Kernel Mode stack from the TSS (see the sections “Hardware Handling of Interrupts and Exceptions” in Chapter 4 and “Issuing a System Call via the sysenter Instruction” in Chapter 10).
- When a User Mode process attempts to access an I/O port by means of an in or out instruction,the CPU may need to access an I/O Permission Bitmap stored in the TSS to verify whether the process is allowed to address the port.
More precisely,when a process executes an in or out I/O instruction in User Mode,the control unit performs the following operations:
- It checks the 2-bit IOPL field in the eflags register. If it is set to 3,the control unit executes the I/O instructions. Otherwise,it performs the next check.
- It accesses the tr register to determine the current TSS,and thus the proper I/O Permission Bitmap.
- It checks the bit of the I/O Permission Bitmap corresponding to the I/O port specified in the I/O instruction. If it is cleared,the instruction is executed; otherwise,the control unit raises a “General protection ” exception.
The tss_struct structure describes the format of the TSS. As already mentioned in Chapter 2,the init_tss array stores one TSS for each CPU on the system. At each process switch,the kernel updates some fields of the TSS so that the corresponding CPU’s control unit may safely retrieve the information it needs. Thus,the TSS reflects the privilege of the current process on the CPU,but there is no need to maintain TSSs for processes when they’re not running.
另一个潜在的参考是这一个,它确实有更多的x86特定的东西,你可能会从与PowerPC的对比中获益一点.
Linux?KernelPrimer,:x86和PowerPC架构的自上而下方法
Claudia Salzberg Rodriguez;戈登菲舍尔;史蒂文斯莫尔斯基
出版商:Prentice Hall
酒吧.日期:2005年9月19日
打印ISBN-10:0-13-118163-7
打印ISBN-13:978-0-13-118163-2
Safari,Amazon
最后,Robert Love的Linux内核开发第3版对上下文切换有一个非常详尽的描述,尽管它可能与上述内容有关.这是一个非常棒的资源.