Re: A question about switch_to macro

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

 



Hi,

ZelluX <zellux@xxxxxxxxx> 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

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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