linux ÄÚÁª»ã±à
Çë½Ì¸ßÊÖ, linux ÄÚÁª»ã±àÖÐ, ".previous" ÊÇʲôº¬Òå°¡? This is one of the ELF section stack manipulation directives. Theothers are `.section' ( Section), `.subsection' (
SubSection), `.pushsection' ( PushSection), and `.popsection'
( PopSection). ллfoxc µÄ»Ø¸´, ÎÒÈ¥¿´¿´ELFµÄ¸ñʽ.ÏÂÃæÕâ¶Î»ã±àÎÒ´ó¸Å¿´¶®ÁË, ÎÒµÄÒÉÎÊÊÇ, "1:\n"ÊDz»ÊÇÕâ¶Î»ã±àµÄ½áÊøÓï¾ä, Ϊʲô²»»á¼ÌÐøÍùÏÂ˳ÐòÖ´ÐÐ?Çë¸÷λ¸ßÊִͽÌ, лл!
#define LOCK_SECTION_START(extra) \
".subsection 1\n\t" \
extra \
".ifndef " LOCK_SECTION_NAME "\n\t" \
LOCK_SECTION_NAME ":\n\t" \
".endif\n\t"
#define LOCK_SECTION_END \
".previous\n\t"
static inline void up(struct semaphore * sem)
{
#if WAITQUEUE_DEBUG
CHECK_MAGIC(sem->__magic);
#endif
__asm__ __volatile__(
"# atomic up operation\n\t"
LOCK "incl %0\n\t" /* ++sem->count */
"jle 2f\n"
"1:\n"
LOCK_SECTION_START("")
"2:\tcall __up_wakeup\n\t"
"jmp 1b\n"
LOCK_SECTION_END
".subsection 0\n"
:"=m" (sem->count)
:"c" (sem)
:"memory");
}
Ò³:
[1]