Hello
In linux kernel in the implementation of spinlocks, e.g. http://lxr.linux.no/#linux+v2.6.18/include/asm-i386/semaphore.h#L97
97static inline void down(struct semaphore * sem)
98{
99 might_sleep();
100 __asm__ __volatile__(
101 "# atomic down operation\n\t"
102 LOCK_PREFIX "decl %0\n\t" /* --sem->count */
103 "js 2f\n"
104 "1:\n"
105 LOCK_SECTION_START("")
106 "2:\tlea %0,%%eax\n\t"
107 "call __down_failed\n\t"
108 "jmp 1b\n"
109 LOCK_SECTION_END
110 :"+m" (sem->count)
111 :
112 :"memory","ax");
113}
LOCK_SECTION_START and LOCK_SECTION_END are used. They are defined in http://lxr.linux.no/#linux+v2.6.18/include/linux/spinlock.h#L63 as
61#define LOCK_SECTION_NAME ".text.lock."KBUILD_BASENAME
62
63#define LOCK_SECTION_START(extra) \
64 ".subsection 1\n\t" \
65 extra \
66 ".ifndef " LOCK_SECTION_NAME "\n\t" \
67 LOCK_SECTION_NAME ":\n\t" \
68 ".endif\n"
69
70#define LOCK_SECTION_END \
71 ".previous\n\t"
So all locked operations are partly putted in subsection 1
or section .text.lock.SMTH_STRING.
What reason is for it?