- 論壇徽章:
- 0
|
回復(fù) 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
果中斷發(fā)生在內(nèi)核空間,則控制權(quán)直接轉(zhuǎn)移到標(biāo)號restore_all。如果中斷發(fā)生于用戶空間(或VM86模式),則轉(zhuǎn)移到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)表示當(dāng)前進(jìn)程task_struct結(jié)構(gòu)中偏移量need_resched處的內(nèi)容,如果調(diào)度標(biāo)志為非0,說明需要進(jìn)行調(diào)度,則去調(diào)用schedule()
__schedule
中 idle_balance(cpu, rq); 負(fù)責(zé)smp下的cpu切換(負(fù)載均衡)
context_switch 負(fù)責(zé)切換到新的進(jìn)程。switch_to負(fù)責(zé)堆棧等恢復(fù)
再結(jié)合83兄的兩文章
應(yīng)該就能搞懂了。后面再看下堆;謴(fù)相關(guān)的
|
|