.section .text data: .byte 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01#8字节 .globl main main: movl $0x12345678,%edx bswap %edx#反转字符顺序 ,结果为0x87654321 movl %edx,%eax movl $1,%ebx xadd %ebx,%eax#交换%eax和%ebx的值,并相加,结果放在目标位置%eax cmpxchg %edx,%ebx#如果目标操作数%ebx等于%eax、16位是ax,8位是al,则把源操作数%edx的值加载到%eax中、16位 #是ax,8位是al,如果不等,则把目标操作数%ebx加到源操作数%edx加载到%eax中、16位是ax,8位是al movl $2,%edx#高位 movl $3,%eax#低位 cmpxchg8b data#如果%edx:%eax组成的8字节值与目标值data匹配,则把%edx:%eax组成的8字节值传送到目标内存位置 #,否则将目标值data加载到%edx:%eax pushad popad #pusha/popa 压入弹出所有16位通用寄存器 #pushad/popad 压入弹出所有32位通用寄存器 #pushf/popf 压入弹出EFLAGS寄存器的低16位 #pushf/popf 压入弹出EFLAGS寄存器的全部32位