Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly 为什么linux内核中的spinlock位于";。第1款;(或“text.lock.smth”)?_Assembly_Locking_Linux Kernel_Spinlock - Fatal编程技术网

Assembly 为什么linux内核中的spinlock位于";。第1款;(或“text.lock.smth”)?

Assembly 为什么linux内核中的spinlock位于";。第1款;(或“text.lock.smth”)?,assembly,locking,linux-kernel,spinlock,Assembly,Locking,Linux Kernel,Spinlock,在linux内核中实现自旋锁,例如。 使用“锁定区段”开始和“锁定区段”结束。它们的定义如下: 因此,所有锁定的操作都部分地放在子部分1或section.text.lock.SMTH_字符串中 原因是什么?我不是100%确定,但我认为这与内核在启动时甚至在运行时可以在SMP和UP之间切换有关。在用户空间的原子中,第1小节也用于什么? 97static inline void down(struct semaphore * sem) 98{ 99 might_sleep

在linux内核中实现自旋锁,例如。

使用“锁定区段”开始和“锁定区段”结束。它们的定义如下:

因此,所有锁定的操作都部分地放在
子部分1
或section.text.lock.SMTH_字符串中


原因是什么?

我不是100%确定,但我认为这与内核在启动时甚至在运行时可以在SMP和UP之间切换有关。

在用户空间的原子中,第1小节也用于什么?
  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}
  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"