Got it, many thanks ;-)

On Fri, Aug 8, 2008 at 2:53 AM, Johannes Weiner <[EMAIL PROTECTED]> wrote:

> Hi,
>
> ZelluX <[EMAIL PROTECTED]> writes:
>
> > In Linux Kernel 2.6.11, the switch_to macro is defined as follows(on x86
> > platform)
> >
> > 15#define switch_to(prev,next,last) do {
>  \
> > 16        unsigned long esi,edi;
>  \
> > 17        asm volatile("pushfl\n\t"
> \
> > 18                     "pushl %%ebp\n\t"
>  \
> > 19                     "movl %%esp,%0\n\t"        /* save ESP */
>  \
> > 20                     "movl %5,%%esp\n\t"        /* restore ESP */
> \
> > 21                     "movl $1f,%1\n\t"          /* save EIP */
>  \
> > 22                     "pushl %6\n\t"             /* restore EIP */
> \
> > 23                     "jmp __switch_to\n"
>  \
> > 24                     "1:\t"
> \
> > 25                     "popl %%ebp\n\t"
> \
> > 26                     "popfl"
>  \
> > 27                     :"=m" (prev->thread.esp),"=m" (prev->thread.eip),
>  \
> > 28                      "=a" (last),"=S" (esi),"=D" (edi)
> \
> > 29                     :"m" (next->thread.esp),"m" (next->thread.eip),
>  \
> > 30                      "2" (prev), "d" (next));
>  \
> > 31} while (0)
> >
> > In the middle of the code there's a movl instruction
> >   21                     "movl $1f,%1\n\t"          /* save EIP
> > */          \
> >
> > which saves the address labeled 1 in prev->thread.eip as ULK points out.
> >
> > My question is why there's an f after $1? Is there any specification to
> > this grammar?
>
> It specifies that the address referred to is further down the code
> sequence.  If it would be before the movl, it'd be 1b.
>
>        Hannes
>

Reply via email to