- 论坛徽章:
- 16
|
本帖最后由 embeddedlwp 于 2011-10-17 20:02 编辑
回复 26# asuka2001
请看linux 2.6.11的__switch_to的实现,__switch_to的作用就是硬件上下文切换(主要就是ESP0与IO许可权位图):- struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
- {
-
- 。。。。。。。。。。。。
- /*
- * Reload esp0, LDT and the page table pointer:
- */
- load_esp0(tss, next);
- 。。。。。。。。。。。。
- }
- static inline void load_esp0(struct tss_struct *tss, struct thread_struct *thread)
- {
- tss->esp0 = thread->esp0;
- /* This can only happen when SEP is enabled, no need to test "SEP"arately */
- if (unlikely(tss->ss1 != thread->sysenter_cs)) {
- tss->ss1 = thread->sysenter_cs;
- wrmsr(MSR_IA32_SYSENTER_CS, thread->sysenter_cs, 0);
- }
- }
复制代码 这里加载的是thread->esp0,而且《linux内核源代码情景分析》P265说“对于linux内核来说,TSS中有意义的就只剩下0级的堆栈指针,也就是SS0和ESP0两项了” 求指点! |
|