Re: why does switch_to need three arguments?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 03 Oct 2004 10:17:42 +0800, Bao zhao <paozhaokeats@xxxxxxxxxxx> wrote:
>   hi, I'm sorry for misleading you because of my poor english. I'm talking
> about switch_to function,
> this function's  first argument and  third argument always  are same ,so I
> think  switch_to 's arguments is redundant.
> 
> >From: manish regmi <regmi.manish@xxxxxxxxx>
> >Reply-To: manish regmi <regmi.manish@xxxxxxxxx>
> >To: Bao zhao <paozhaokeats@xxxxxxxxxxx>
> >Subject: Re: why does switch_to need three arguments?
> >Date: Sun, 3 Oct 2004 07:54:49 +0545
> 
> 
> >
> >On Sun, 03 Oct 2004 08:41:29 +0800, Bao zhao <paozhaokeats@xxxxxxxxxxx>
> >wrote:
> > > In 2.6.0 kernel,
> > >
> > > context_switch function is the only one which calls switch_to, and the
> >first
> > > argument and the third argument are same. Is it not redundant?
> > >
> > > static inline task_t * context_switch(runqueue_t *rq, task_t *prev,
> >task_t
> > > *next)
> > > {
> > > ....
> > > switch_to(prev, next, prev);
> > >               ....
> > > }
> > >
> > > Thanks in advance !
> > >
> >
> >hi,
> >  In 2.6 kernel, there is a per cpu runqueue. So,  the first argument
> >is the runqueue, the second and third are the tasks to switch.
> >
> >regards Manish
> 

Sorry,
 That was my mistake.
 As you see in switch_to, It call __switch_to which is a c function in
arch/asm/process.c. __switch_to returns the pointer to prev task after
changing the various stuffs.
No as you know in i386 the returned value in C is stored in EAX
register. So it is stored in last.

Now during times like ret_from_fork which is called by fresh forked
task. it requires the pointer to prev task  on eax. And call to
schedule tail to finish fork .
        pushl %eax
	call schedule_tail
	GET_THREAD_INFO(%ebp)
	popl %eax

I think it is for times like this. 

regards manish

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux