- 论坛徽章:
- 0
|
回复 13# wzw200
重新整理了下思路 和搜了下资料。更明白了些。这里分享出来。
http://
blog.csdn.net/shaohaigod1981/article/details/4768449
从中断返回,也就是irq_exit之后
ENTRY(ret_from_intr)
GET_CURRENT(%ebx)
ret_from_exception:
movl EFLAGS(%esp),%eax # mix EFLAGS and CS
movb CS(%esp),%al
testl $(VM_MASK | 3),%eax # return to VM86 mode or non-supervisor?
jne ret_from_sys_call
jmp restore_all
果中断发生在内核空间,则控制权直接转移到标号restore_all。如果中断发生于用户空间(或VM86模式),则转移到ret_from_sys_call:
ENTRY(ret_from_sys_call)
cli # need_resched and signals atomic test
cmpl $0,need_resched(%ebx)
jne reschedule
cmpl $0,sigpending(%ebx)
jne signal_return
restore_all:
RESTORE_ALL
need_resched(%ebx)表示当前进程task_struct结构中偏移量need_resched处的内容,如果调度标志为非0,说明需要进行调度,则去调用schedule()
__schedule
中 idle_balance(cpu, rq); 负责smp下的cpu切换(负载均衡)
context_switch 负责切换到新的进程。switch_to负责堆栈等恢复
再结合83兄的两文章
应该就能搞懂了。后面再看下堆栈恢复相关的
|
|