schedule()的函数是这样的:
void schedule()
{
/**********
找出下一任务号next
*********/
switch_to(next);
}
switch_to(n)是这样的一个宏
#define switch_to(n) {\
struct {long a,b;} __tmp; \
__asm__("cmpl %%ecx,_current\n\t" \
"je 1f\n\t" \
"movw %%dx,%1\n\t" \
"xchgl %%ecx,_current\n\t" \
"ljmp %0\n\t" \ /***从这里跳走后何时回来执行下面的指令从而完成schedule()调用?****/
"cmpl %%ecx,_last_task_used_math\n\t" \
"jne 1f\n\t" \
"clts\n" \
"1:" \
::"m" (*&__tmp.a),"m" (*&__tmp.b), \
"d" (_TSS(n)),"c" ((long) task[n])); \
}