Look at the following x86 assembly code (from lua repository).
static inline void coco_switch(coco_ctx from, coco_ctx to)
{
__asm__ __volatile__ (
"call 1f\n" "1:\tpopl %%eax\n\t" "addl $(2f-1b),%%eax\n\t"
"movl %%eax, (%0)\n\t" "movl %%esp, 4(%0)\n\t"
"movl %%ebp, 8(%0)\n\t" "movl %%ebx, 12(%0)\n\t"
"movl 12(%1), %%ebx\n\t" "movl 8(%1), %%ebp\n\t"
"movl 4(%1), %%esp\n\t" "jmp *(%1)\n" "2:\n"
: "+S" (from), "+D" (to) : : "eax", "ecx", "edx", "memory", "cc");
}
What does 1f
, 1b
, or 2f
mean?
In general, they are indicators to local labels (see 1:
and 2:
).
In particular, xf
will look for the local label x
after current location,
while xb
will look for the local label x
before current position.
Find further information from this documentation.