LinuxÒÁµéÔ°ÂÛ̳'s Archiver

elastosfeng ·¢±íÓÚ 2006-10-12 11:18

linux ÄÚÁª»ã±à

Çë½Ì¸ßÊÖ, linux ÄÚÁª»ã±àÖÐ, ".previous" ÊÇʲôº¬Òå°¡?

foxc ·¢±íÓÚ 2006-10-12 16:44

This is one of the ELF section stack manipulation directives. The

others are `.section' ( Section), `.subsection' (

SubSection), `.pushsection' ( PushSection), and `.popsection'

( PopSection).

elastosfeng ·¢±íÓÚ 2006-10-17 15:46

лл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]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.