In Linux Kernel 2.6.11, the switch_to macro is defined as follows(on x86
platform)

  15 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L15>#define
switch_to <http://lxr.linux.no/linux+v2.6.11/+code=switch_to>(prev
<http://lxr.linux.no/linux+v2.6.11/+code=prev>,next
<http://lxr.linux.no/linux+v2.6.11/+code=next>,last
<http://lxr.linux.no/linux+v2.6.11/+code=last>) do {
               \
  16 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L16>
       unsigned long esi
<http://lxr.linux.no/linux+v2.6.11/+code=esi>,edi
<http://lxr.linux.no/linux+v2.6.11/+code=edi>;
                 \
  17 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L17>
       asm volatile("pushfl\n\t"
\
  18 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L18>
                    "pushl %%ebp\n\t"
\
  19 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L19>
                    "movl %%esp,%0\n\t"        /* save ESP */
\
  20 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L20>
                    "movl %5,%%esp\n\t"        /* restore ESP */
\
  21 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L21>
                    "movl $1f,%1\n\t"          /* save EIP */
\
  22 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L22>
                    "pushl %6\n\t"             /* restore EIP */
\
  23 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L23>
                    "jmp __switch_to\n"
\
  24 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L24>
                    "1:\t"
\
  25 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L25>
                    "popl %%ebp\n\t"
\
  26 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L26>
                    "popfl"
\
  27 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L27>
                    :"=m" (prev
<http://lxr.linux.no/linux+v2.6.11/+code=prev>->thread
<http://lxr.linux.no/linux+v2.6.11/+code=thread>.esp
<http://lxr.linux.no/linux+v2.6.11/+code=esp>),"=m" (prev
<http://lxr.linux.no/linux+v2.6.11/+code=prev>->thread
<http://lxr.linux.no/linux+v2.6.11/+code=thread>.eip
<http://lxr.linux.no/linux+v2.6.11/+code=eip>),  \
  28 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L28>
                     "=a" (last
<http://lxr.linux.no/linux+v2.6.11/+code=last>),"=S" (esi
<http://lxr.linux.no/linux+v2.6.11/+code=esi>),"=D" (edi
<http://lxr.linux.no/linux+v2.6.11/+code=edi>)                 \
  29 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L29>
                    :"m" (next
<http://lxr.linux.no/linux+v2.6.11/+code=next>->thread
<http://lxr.linux.no/linux+v2.6.11/+code=thread>.esp
<http://lxr.linux.no/linux+v2.6.11/+code=esp>),"m" (next
<http://lxr.linux.no/linux+v2.6.11/+code=next>->thread
<http://lxr.linux.no/linux+v2.6.11/+code=thread>.eip
<http://lxr.linux.no/linux+v2.6.11/+code=eip>),    \
  30 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L30>
                     "2" (prev
<http://lxr.linux.no/linux+v2.6.11/+code=prev>), "d" (next
<http://lxr.linux.no/linux+v2.6.11/+code=next>));
    \
  31 <http://lxr.linux.no/linux+v2.6.11/include/asm-i386/system.h#L31>}
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?

Many thanks for your reply.

Reply via email to