In Linux Kernel 2.6.11, the switch_to macro is defined as follows(on x86 platform)
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.
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?
Many thanks for your reply.