ytsmtipe 发表于 2007-08-28 14:12

关于gas语法的问题.

兄弟最近正在看读写锁的实现,如下这段汇编的这一句{".section .text.lock,\"ax\"\n" \}不太明白,特别是这句中的"ax"是做什么的?恳请各位赐教,谢谢!
#define __build_write_lock_const(rw, helper) \
   asm volatile(LOCK "subl $" RW_LOCK_BIAS_STR ",(%0)\n\t" \
   "jnz 2f\n" \
   "1:\n" \
   ".section .text.lock,\"ax\"\n" \
   "2:\tpushl %%eax\n\t" \
   "leal %0,%%eax\n\t" \
   "call " helper "\n\t" \
   "popl %%eax\n\t" \
   "jmp 1b\n" \
   ".previous" \
   :"=m" (*(volatile int *)rw) : : "memory")

bluster 发表于 2007-08-28 14:22

原帖由 ytsmtipe 于 2007-8-28 14:12 发表 http://linux.chinaunix.net/bbs/images/common/back.gif
兄弟最近正在看读写锁的实现,如下这段汇编的这一句{".section .text.lock,\"ax\"\n" \}不太明白,特别是这句中的"ax"是做什么的?恳请各位赐教,谢谢!
#define __build_write_lock_const(rw, helper) \
   asm ...
info as

`a'
   section is allocatable
`x'
   section is executable

ytsmtipe 发表于 2007-08-28 14:55

呵呵!非常感谢!
    原以为是寄存器呢.

MMMIX 发表于 2007-08-28 18:45

原帖由 ytsmtipe 于 2007-8-28 14:55 发表 http://linux.chinaunix.net/bbs/images/common/back.gif
呵呵!非常感谢!
    原以为是寄存器呢.
碰到这种问题就先查下手册嘛.
页: [1]
查看完整版本: 关于gas语法的问题.