64位原子操作的加法的实现。只有看汇编才能理解. 64位的数据比较和交换EDX:EAX和ECX:EBX [plain] view plain copy
- 1100306:80b5ef20 <atomic64_inc_return_cx8>:
- 1100307-80b5ef20: 53 push %ebx
- 1100308-80b5ef21: 89 d8 mov %ebx,%eax
- 1100309-80b5ef23: 89 ca mov %ecx,%edx
- 1100310-80b5ef25: f0 0f c7 0e lock cmpxchg8b (%esi)
- 1100311-80b5ef29: 89 c3 mov %eax,%ebx
- 1100312-80b5ef2b: 89 d1 mov %edx,%ecx
- 1100313-80b5ef2d: 83 c3 01 add $0x1,%ebx
- 1100314-80b5ef30: 83 d1 00 adc $0x0,%ecx
- 1100315-80b5ef33: f0 0f c7 0e lock cmpxchg8b (%esi)
- 1100316-80b5ef37: 75 f0 jne 80b5ef29 <atomic64_inc_return_cx8+0x9>
- 1100317-80b5ef39: 89 d8 mov %ebx,%eax
- 1100318-80b5ef3b: 89 ca mov %ecx,%edx
- 1100319-80b5ef3d: 5b pop %ebx
- 1100320-80b5ef3e: c3 ret
- 1100321-80b5ef3f: 90 nop
|