gcc asm '.section.text.lock"
Posted: Tue Oct 25, 2016 12:14 am
I am reading the source code of linux 2.4.
The following code is the entry of 'up' operation of semaphore. It's located in include/asm-i386-semaphore.h .
This line :
".section .text.lock,\"ax\"\n"
What's he doing? The syntax seems horrible. I even don't know how to google it.
Could any friend help me? Thanks!
The following code is the entry of 'up' operation of semaphore. It's located in include/asm-i386-semaphore.h .
Code: Select all
static inline void down(struct semaphore * sem)
{
__asm__ __volatile__(
"# atomic down operation\n\t"
LOCK "decl %0\n\t" /* --sem->count */
"js 2f\n"
"1:\n"
".section .text.lock,\"ax\"\n" /* I don't understand this line*/
"2:\tcall __down_failed\n\t"
"jmp 1b\n"
".previous"
:"=m" (sem->count)
:"c" (sem)
:"memory");
}
".section .text.lock,\"ax\"\n"
What's he doing? The syntax seems horrible. I even don't know how to google it.
Could any friend help me? Thanks!