简单!!高分!!Linux0.01中的简单问题—关于switch_to(n)。

aprilsnow aprilsnow 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

我在阅读Linux0.01代码时怎么也弄不懂这一段的用处:

/*
* switch_to(n) should switch tasks to task nr n, first
* checking that n isn't the current task, in which case it does nothing.
* This also clears the TS-flag if the task we switched to has used
* tha math co-processor latest.
*/
#define switch_to(n) {\
struct {long a,b;} __tmp; \
__asm__("cmpl %%ecx,_current\n\t" \
"je 1f\n\t" \
"xchgl %%ecx,_current\n\t" \
"movw %%dx,%1\n\t" \
"ljmp %0\n\t" \
"cmpl %%ecx,%2\n\t" \
"jne 1f\n\t" \
"clts\n" \
"1:" \
::"m" (*&__tmp.a),"m" (*&__tmp.b), \
"m" (last_task_used_math),"d" _TSS(n),"c" ((long) task[n])); \
}


AT&T汇编实在太难懂了,请问各位这一段做了什么啊?
明明输入参数有5个,为什么只能在代码中找到%0、%1、%2这三个东东啊?
这个问题把我郁闷死了,求大家帮忙!不胜感激!!
...全文
评论 5
收藏 已收藏
分享
返回顶部
aprilsnow
Linux_Kernel 4,469 成员 17,458 内容