Message-ID: <4HACME$wWM@smth.org>
Subject: Re: �诤� switch_to ��一���苫�����指�!
Date: Sat, 12 Mar 2005 02:17:12 +0000
From: Unknown <anon@nohost.local>
Path: news.cnusenet.org!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-cn.bbs.comp.unix.development.kernel.mbox.zip!g2news1.google.com!news3.google.com!news.glorb.com!newscon02.news.prodigy.com!prodigy.net!newsfeed.frii.net!newsfeed.frii.net!140.99.99.194.MISMATCH!newsfeed1.easynews.com!easynews.com!easynews!sjc-c01.usenetserver.com!news.bylinux.net!maily.cic.tsinghua.edu.cn!SMTH
Newsgroups: cn.bbs.comp.unix.development.kernel
Organization: BBS 水木�华站
Mime-Version: 1.0
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: 8bit
X-Filename: KernelTech/R/M.1110593582.80
Lines: 44
Xref: news.cnusenet.org cn.bbs.comp.unix.development.kernel:28716

pushl %4\n\t
jmp __switch_to\n\t
��模��call __switch_to����思����要����__switch_to�姆��氐�址�冉����,����使�������址���
��司筒������__switch_to()����������位����
edi��诺�应���堑�一������
ebp��诺�应���堑诙�������
�� �� flyinwindy (����注��) �拇������到: ��
: ���诤��� ���群���
:   schedule(void)
:   {
:         struct task_struct *prev, *next, *p;
: ...
:         switch_to(prev, next, prev);
: ...
: }
: #define switch_to(prev,next,last) do {                                  \
:         asm volatile("pushl %%esi\n\t"                                  \
:                      "pushl %%edi\n\t"                                  \
:                      "pushl %%ebp\n\t"                                  \
:                      "movl %%esp,%0\n\t"        /* save ESP */          \
:                      "movl %3,%%esp\n\t"        /* restore ESP */       \
:                      "movl $1f,%1\n\t"          /* save EIP */          \
:                      "pushl %4\n\t"             /* restore EIP */       \
:                      "jmp __switch_to\n"       //����__switch_to������么���� \
:                      "1:\t"                                             \
:                      "popl %%ebp\n\t"                                   \
:                      "popl %%edi\n\t"                                   \
:                      "popl %%esi\n\t"                                   \
:                      :"=m" (prev->thread.esp),"=m" (prev->thread.eip),  \
:                       "=b" (last)                                       \
:                      :"m" (next->thread.esp),"m" (next->thread.eip),    \
:                       "a" (prev), "d" (next),                           \
:                       "b" (prev));                                      \
: } while (0)
: void __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
:  {
: }
: �������� __switch_to�值�������������么�������摹�
: ��一直��太���祝�����指��一��  �����屑�


--

�� ��源:��BBS 水木�华站 smth.org��[FROM: 202.118.70.*]