MFp4: Bring back comments.

Requested by:	jhb
This commit is contained in:
pjd 2007-04-12 23:14:25 +00:00
parent 3e40f10d80
commit 52f379b390
4 changed files with 358 additions and 358 deletions

View File

@ -78,52 +78,52 @@
ENTRY(atomic_inc_8_nv)
ALTENTRY(atomic_inc_uchar_nv)
movb (%rdi), %al
movb (%rdi), %al // %al = old value
1:
leaq 1(%rax), %rcx
leaq 1(%rax), %rcx // %cl = new value
lock
cmpxchgb %cl, (%rdi)
cmpxchgb %cl, (%rdi) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_inc_uchar_nv)
SET_SIZE(atomic_inc_8_nv)
ENTRY(atomic_inc_16_nv)
ALTENTRY(atomic_inc_ushort_nv)
movw (%rdi), %ax
movw (%rdi), %ax // %ax = old value
1:
leaq 1(%rax), %rcx
leaq 1(%rax), %rcx // %cx = new value
lock
cmpxchgw %cx, (%rdi)
cmpxchgw %cx, (%rdi) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_inc_ushort_nv)
SET_SIZE(atomic_inc_16_nv)
ENTRY(atomic_inc_32_nv)
ALTENTRY(atomic_inc_uint_nv)
movl (%rdi), %eax
movl (%rdi), %eax // %eax = old value
1:
leaq 1(%rax), %rcx
leaq 1(%rax), %rcx // %ecx = new value
lock
cmpxchgl %ecx, (%rdi)
cmpxchgl %ecx, (%rdi) // try to stick it in
jne 1b
movl %ecx, %eax
movl %ecx, %eax // return new value
ret
SET_SIZE(atomic_inc_uint_nv)
SET_SIZE(atomic_inc_32_nv)
ENTRY(atomic_inc_64_nv)
ALTENTRY(atomic_inc_ulong_nv)
movq (%rdi), %rax
movq (%rdi), %rax // %rax = old value
1:
leaq 1(%rax), %rcx
leaq 1(%rax), %rcx // %rcx = new value
lock
cmpxchgq %rcx, (%rdi)
cmpxchgq %rcx, (%rdi) // try to stick it in
jne 1b
movq %rcx, %rax
movq %rcx, %rax // return new value
ret
SET_SIZE(atomic_inc_ulong_nv)
SET_SIZE(atomic_inc_64_nv)
@ -162,52 +162,52 @@
ENTRY(atomic_dec_8_nv)
ALTENTRY(atomic_dec_uchar_nv)
movb (%rdi), %al
movb (%rdi), %al // %al = old value
1:
leaq -1(%rax), %rcx
leaq -1(%rax), %rcx // %cl = new value
lock
cmpxchgb %cl, (%rdi)
cmpxchgb %cl, (%rdi) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_dec_uchar_nv)
SET_SIZE(atomic_dec_8_nv)
ENTRY(atomic_dec_16_nv)
ALTENTRY(atomic_dec_ushort_nv)
movw (%rdi), %ax
movw (%rdi), %ax // %ax = old value
1:
leaq -1(%rax), %rcx
leaq -1(%rax), %rcx // %cx = new value
lock
cmpxchgw %cx, (%rdi)
cmpxchgw %cx, (%rdi) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_dec_ushort_nv)
SET_SIZE(atomic_dec_16_nv)
ENTRY(atomic_dec_32_nv)
ALTENTRY(atomic_dec_uint_nv)
movl (%rdi), %eax
movl (%rdi), %eax // %eax = old value
1:
leaq -1(%rax), %rcx
leaq -1(%rax), %rcx // %ecx = new value
lock
cmpxchgl %ecx, (%rdi)
cmpxchgl %ecx, (%rdi) // try to stick it in
jne 1b
movl %ecx, %eax
movl %ecx, %eax // return new value
ret
SET_SIZE(atomic_dec_uint_nv)
SET_SIZE(atomic_dec_32_nv)
ENTRY(atomic_dec_64_nv)
ALTENTRY(atomic_dec_ulong_nv)
movq (%rdi), %rax
movq (%rdi), %rax // %rax = old value
1:
leaq -1(%rax), %rcx
leaq -1(%rax), %rcx // %rcx = new value
lock
cmpxchgq %rcx, (%rdi)
cmpxchgq %rcx, (%rdi) // try to stick it in
jne 1b
movq %rcx, %rax
movq %rcx, %rax // return new value
ret
SET_SIZE(atomic_dec_ulong_nv)
SET_SIZE(atomic_dec_64_nv)
@ -278,28 +278,28 @@
ENTRY(atomic_add_8_nv)
ALTENTRY(atomic_add_char_nv)
movb (%rdi), %al
movb (%rdi), %al // %al = old value
1:
movb %sil, %cl
addb %al, %cl
addb %al, %cl // %cl = new value
lock
cmpxchgb %cl, (%rdi)
cmpxchgb %cl, (%rdi) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_add_char_nv)
SET_SIZE(atomic_add_8_nv)
ENTRY(atomic_add_16_nv)
ALTENTRY(atomic_add_short_nv)
movw (%rdi), %ax
movw (%rdi), %ax // %ax = old value
1:
movw %si, %cx
addw %ax, %cx
addw %ax, %cx // %cx = new value
lock
cmpxchgw %cx, (%rdi)
cmpxchgw %cx, (%rdi) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_add_short_nv)
SET_SIZE(atomic_add_16_nv)
@ -336,28 +336,28 @@
ENTRY(atomic_and_8_nv)
ALTENTRY(atomic_and_uchar_nv)
movb (%rdi), %al
movb (%rdi), %al // %al = old value
1:
movb %sil, %cl
andb %al, %cl
andb %al, %cl // %cl = new value
lock
cmpxchgb %cl, (%rdi)
cmpxchgb %cl, (%rdi) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_and_uchar_nv)
SET_SIZE(atomic_and_8_nv)
ENTRY(atomic_and_16_nv)
ALTENTRY(atomic_and_ushort_nv)
movw (%rdi), %ax
movw (%rdi), %ax // %ax = old value
1:
movw %si, %cx
andw %ax, %cx
andw %ax, %cx // %cx = new value
lock
cmpxchgw %cx, (%rdi)
cmpxchgw %cx, (%rdi) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_and_ushort_nv)
SET_SIZE(atomic_and_16_nv)
@ -392,28 +392,28 @@
ENTRY(atomic_or_8_nv)
ALTENTRY(atomic_or_uchar_nv)
movb (%rdi), %al
movb (%rdi), %al // %al = old value
1:
movb %sil, %cl
orb %al, %cl
orb %al, %cl // %cl = new value
lock
cmpxchgb %cl, (%rdi)
cmpxchgb %cl, (%rdi) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_and_uchar_nv)
SET_SIZE(atomic_and_8_nv)
ENTRY(atomic_or_16_nv)
ALTENTRY(atomic_or_ushort_nv)
movw (%rdi), %ax
movw (%rdi), %ax // %ax = old value
1:
movw %si, %cx
orw %ax, %cx
orw %ax, %cx // %cx = new value
lock
cmpxchgw %cx, (%rdi)
cmpxchgw %cx, (%rdi) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_or_ushort_nv)
SET_SIZE(atomic_or_16_nv)
@ -527,7 +527,7 @@
lock
btsq %rsi, (%rdi)
jnc 1f
decl %eax
decl %eax // return -1
1:
ret
SET_SIZE(atomic_set_long_excl)
@ -537,7 +537,7 @@
lock
btrq %rsi, (%rdi)
jc 1f
decl %eax
decl %eax // return -1
1:
ret
SET_SIZE(atomic_clear_long_excl)

View File

@ -75,28 +75,28 @@
ENTRY(atomic_inc_8_nv)
ALTENTRY(atomic_inc_uchar_nv)
movl 4(%esp), %edx
movb (%edx), %al
movl 4(%esp), %edx // %edx = target address
movb (%edx), %al // %al = old value
1:
leal 1(%eax), %ecx
leal 1(%eax), %ecx // %cl = new value
lock
cmpxchgb %cl, (%edx)
cmpxchgb %cl, (%edx) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_inc_uchar_nv)
SET_SIZE(atomic_inc_8_nv)
ENTRY(atomic_inc_16_nv)
ALTENTRY(atomic_inc_ushort_nv)
movl 4(%esp), %edx
movw (%edx), %ax
movl 4(%esp), %edx // %edx = target address
movw (%edx), %ax // %ax = old value
1:
leal 1(%eax), %ecx
leal 1(%eax), %ecx // %cx = new value
lock
cmpxchgw %cx, (%edx)
cmpxchgw %cx, (%edx) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_inc_ushort_nv)
SET_SIZE(atomic_inc_16_nv)
@ -104,14 +104,14 @@
ENTRY(atomic_inc_32_nv)
ALTENTRY(atomic_inc_uint_nv)
ALTENTRY(atomic_inc_ulong_nv)
movl 4(%esp), %edx
movl (%edx), %eax
movl 4(%esp), %edx // %edx = target address
movl (%edx), %eax // %eax = old value
1:
leal 1(%eax), %ecx
leal 1(%eax), %ecx // %ecx = new value
lock
cmpxchgl %ecx, (%edx)
cmpxchgl %ecx, (%edx) // try to stick it in
jne 1b
movl %ecx, %eax
movl %ecx, %eax // return new value
ret
SET_SIZE(atomic_inc_ulong_nv)
SET_SIZE(atomic_inc_uint_nv)
@ -121,20 +121,20 @@
ALTENTRY(atomic_inc_64_nv)
pushl %edi
pushl %ebx
movl 12(%esp), %edi
movl 12(%esp), %edi // %edi = target address
movl (%edi), %eax
movl 4(%edi), %edx
movl 4(%edi), %edx // %edx:%eax = old value
1:
xorl %ebx, %ebx
xorl %ecx, %ecx
incl %ebx
incl %ebx // %ecx:%ebx = 1
addl %eax, %ebx
adcl %edx, %ecx
adcl %edx, %ecx // add in the carry from inc
lock
cmpxchg8b (%edi)
cmpxchg8b (%edi) // try to stick it in
jne 1b
movl %ebx, %eax
movl %ecx, %edx
movl %ecx, %edx // return new value
popl %ebx
popl %edi
ret
@ -172,28 +172,28 @@
ENTRY(atomic_dec_8_nv)
ALTENTRY(atomic_dec_uchar_nv)
movl 4(%esp), %edx
movb (%edx), %al
movl 4(%esp), %edx // %edx = target address
movb (%edx), %al // %al = old value
1:
leal -1(%eax), %ecx
leal -1(%eax), %ecx // %cl = new value
lock
cmpxchgb %cl, (%edx)
cmpxchgb %cl, (%edx) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_dec_uchar_nv)
SET_SIZE(atomic_dec_8_nv)
ENTRY(atomic_dec_16_nv)
ALTENTRY(atomic_dec_ushort_nv)
movl 4(%esp), %edx
movw (%edx), %ax
movl 4(%esp), %edx // %edx = target address
movw (%edx), %ax // %ax = old value
1:
leal -1(%eax), %ecx
leal -1(%eax), %ecx // %cx = new value
lock
cmpxchgw %cx, (%edx)
cmpxchgw %cx, (%edx) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_dec_ushort_nv)
SET_SIZE(atomic_dec_16_nv)
@ -201,14 +201,14 @@
ENTRY(atomic_dec_32_nv)
ALTENTRY(atomic_dec_uint_nv)
ALTENTRY(atomic_dec_ulong_nv)
movl 4(%esp), %edx
movl (%edx), %eax
movl 4(%esp), %edx // %edx = target address
movl (%edx), %eax // %eax = old value
1:
leal -1(%eax), %ecx
leal -1(%eax), %ecx // %ecx = new value
lock
cmpxchgl %ecx, (%edx)
cmpxchgl %ecx, (%edx) // try to stick it in
jne 1b
movl %ecx, %eax
movl %ecx, %eax // return new value
ret
SET_SIZE(atomic_dec_ulong_nv)
SET_SIZE(atomic_dec_uint_nv)
@ -218,21 +218,21 @@
ALTENTRY(atomic_dec_64_nv)
pushl %edi
pushl %ebx
movl 12(%esp), %edi
movl 12(%esp), %edi // %edi = target address
movl (%edi), %eax
movl 4(%edi), %edx
movl 4(%edi), %edx // %edx:%eax = old value
1:
xorl %ebx, %ebx
xorl %ecx, %ecx
not %ecx
not %ebx
not %ebx // %ecx:%ebx = -1
addl %eax, %ebx
adcl %edx, %ecx
adcl %edx, %ecx // add in the carry from inc
lock
cmpxchg8b (%edi)
cmpxchg8b (%edi) // try to stick it in
jne 1b
movl %ebx, %eax
movl %ecx, %edx
movl %ecx, %edx // return new value
popl %ebx
popl %edi
ret
@ -305,30 +305,30 @@
ENTRY(atomic_add_8_nv)
ALTENTRY(atomic_add_char_nv)
movl 4(%esp), %edx
movb (%edx), %al
movl 4(%esp), %edx // %edx = target address
movb (%edx), %al // %al = old value
1:
movl 8(%esp), %ecx
addb %al, %cl
movl 8(%esp), %ecx // %ecx = delta
addb %al, %cl // %cl = new value
lock
cmpxchgb %cl, (%edx)
cmpxchgb %cl, (%edx) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_add_char_nv)
SET_SIZE(atomic_add_8_nv)
ENTRY(atomic_add_16_nv)
ALTENTRY(atomic_add_short_nv)
movl 4(%esp), %edx
movw (%edx), %ax
movl 4(%esp), %edx // %edx = target address
movw (%edx), %ax // %ax = old value
1:
movl 8(%esp), %ecx
addw %ax, %cx
movl 8(%esp), %ecx // %ecx = delta
addw %ax, %cx // %cx = new value
lock
cmpxchgw %cx, (%edx)
cmpxchgw %cx, (%edx) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_add_short_nv)
SET_SIZE(atomic_add_16_nv)
@ -337,15 +337,15 @@
ALTENTRY(atomic_add_int_nv)
ALTENTRY(atomic_add_ptr_nv)
ALTENTRY(atomic_add_long_nv)
movl 4(%esp), %edx
movl (%edx), %eax
movl 4(%esp), %edx // %edx = target address
movl (%edx), %eax // %eax = old value
1:
movl 8(%esp), %ecx
addl %eax, %ecx
movl 8(%esp), %ecx // %ecx = delta
addl %eax, %ecx // %ecx = new value
lock
cmpxchgl %ecx, (%edx)
cmpxchgl %ecx, (%edx) // try to stick it in
jne 1b
movl %ecx, %eax
movl %ecx, %eax // return new value
ret
SET_SIZE(atomic_add_long_nv)
SET_SIZE(atomic_add_ptr_nv)
@ -356,19 +356,19 @@
ALTENTRY(atomic_add_64_nv)
pushl %edi
pushl %ebx
movl 12(%esp), %edi
movl 12(%esp), %edi // %edi = target address
movl (%edi), %eax
movl 4(%edi), %edx
movl 4(%edi), %edx // %edx:%eax = old value
1:
movl 16(%esp), %ebx
movl 20(%esp), %ecx
movl 20(%esp), %ecx // %ecx:%ebx = delta
addl %eax, %ebx
adcl %edx, %ecx
adcl %edx, %ecx // %ecx:%ebx = new value
lock
cmpxchg8b (%edi)
cmpxchg8b (%edi) // try to stick it in
jne 1b
movl %ebx, %eax
movl %ecx, %edx
movl %ecx, %edx // return new value
popl %ebx
popl %edi
ret
@ -377,30 +377,30 @@
ENTRY(atomic_or_8_nv)
ALTENTRY(atomic_or_uchar_nv)
movl 4(%esp), %edx
movb (%edx), %al
movl 4(%esp), %edx // %edx = target address
movb (%edx), %al // %al = old value
1:
movl 8(%esp), %ecx
orb %al, %cl
movl 8(%esp), %ecx // %ecx = delta
orb %al, %cl // %cl = new value
lock
cmpxchgb %cl, (%edx)
cmpxchgb %cl, (%edx) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_or_uchar_nv)
SET_SIZE(atomic_or_8_nv)
ENTRY(atomic_or_16_nv)
ALTENTRY(atomic_or_ushort_nv)
movl 4(%esp), %edx
movw (%edx), %ax
movl 4(%esp), %edx // %edx = target address
movw (%edx), %ax // %ax = old value
1:
movl 8(%esp), %ecx
orw %ax, %cx
movl 8(%esp), %ecx // %ecx = delta
orw %ax, %cx // %cx = new value
lock
cmpxchgw %cx, (%edx)
cmpxchgw %cx, (%edx) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_or_ushort_nv)
SET_SIZE(atomic_or_16_nv)
@ -408,15 +408,15 @@
ENTRY(atomic_or_32_nv)
ALTENTRY(atomic_or_uint_nv)
ALTENTRY(atomic_or_ulong_nv)
movl 4(%esp), %edx
movl (%edx), %eax
movl 4(%esp), %edx // %edx = target address
movl (%edx), %eax // %eax = old value
1:
movl 8(%esp), %ecx
orl %eax, %ecx
movl 8(%esp), %ecx // %ecx = delta
orl %eax, %ecx // %ecx = new value
lock
cmpxchgl %ecx, (%edx)
cmpxchgl %ecx, (%edx) // try to stick it in
jne 1b
movl %ecx, %eax
movl %ecx, %eax // return new value
ret
SET_SIZE(atomic_or_ulong_nv)
SET_SIZE(atomic_or_uint_nv)
@ -426,19 +426,19 @@
ALTENTRY(atomic_or_64_nv)
pushl %edi
pushl %ebx
movl 12(%esp), %edi
movl 12(%esp), %edi // %edi = target address
movl (%edi), %eax
movl 4(%edi), %edx
movl 4(%edi), %edx // %edx:%eax = old value
1:
movl 16(%esp), %ebx
movl 20(%esp), %ecx
movl 20(%esp), %ecx // %ecx:%ebx = delta
orl %eax, %ebx
orl %edx, %ecx
orl %edx, %ecx // %ecx:%ebx = new value
lock
cmpxchg8b (%edi)
cmpxchg8b (%edi) // try to stick it in
jne 1b
movl %ebx, %eax
movl %ecx, %edx
movl %ecx, %edx // return new value
popl %ebx
popl %edi
ret
@ -447,30 +447,30 @@
ENTRY(atomic_and_8_nv)
ALTENTRY(atomic_and_uchar_nv)
movl 4(%esp), %edx
movb (%edx), %al
movl 4(%esp), %edx // %edx = target address
movb (%edx), %al // %al = old value
1:
movl 8(%esp), %ecx
andb %al, %cl
movl 8(%esp), %ecx // %ecx = delta
andb %al, %cl // %cl = new value
lock
cmpxchgb %cl, (%edx)
cmpxchgb %cl, (%edx) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_and_uchar_nv)
SET_SIZE(atomic_and_8_nv)
ENTRY(atomic_and_16_nv)
ALTENTRY(atomic_and_ushort_nv)
movl 4(%esp), %edx
movw (%edx), %ax
movl 4(%esp), %edx // %edx = target address
movw (%edx), %ax // %ax = old value
1:
movl 8(%esp), %ecx
andw %ax, %cx
movl 8(%esp), %ecx // %ecx = delta
andw %ax, %cx // %cx = new value
lock
cmpxchgw %cx, (%edx)
cmpxchgw %cx, (%edx) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_and_ushort_nv)
SET_SIZE(atomic_and_16_nv)
@ -478,15 +478,15 @@
ENTRY(atomic_and_32_nv)
ALTENTRY(atomic_and_uint_nv)
ALTENTRY(atomic_and_ulong_nv)
movl 4(%esp), %edx
movl (%edx), %eax
movl 4(%esp), %edx // %edx = target address
movl (%edx), %eax // %eax = old value
1:
movl 8(%esp), %ecx
andl %eax, %ecx
movl 8(%esp), %ecx // %ecx = delta
andl %eax, %ecx // %ecx = new value
lock
cmpxchgl %ecx, (%edx)
cmpxchgl %ecx, (%edx) // try to stick it in
jne 1b
movl %ecx, %eax
movl %ecx, %eax // return new value
ret
SET_SIZE(atomic_and_ulong_nv)
SET_SIZE(atomic_and_uint_nv)
@ -496,19 +496,19 @@
ALTENTRY(atomic_and_64_nv)
pushl %edi
pushl %ebx
movl 12(%esp), %edi
movl 12(%esp), %edi // %edi = target address
movl (%edi), %eax
movl 4(%edi), %edx
movl 4(%edi), %edx // %edx:%eax = old value
1:
movl 16(%esp), %ebx
movl 20(%esp), %ecx
movl 20(%esp), %ecx // %ecx:%ebx = delta
andl %eax, %ebx
andl %edx, %ecx
andl %edx, %ecx // %ecx:%ebx = new value
lock
cmpxchg8b (%edi)
cmpxchg8b (%edi) // try to stick it in
jne 1b
movl %ebx, %eax
movl %ecx, %edx
movl %ecx, %edx // return new value
popl %ebx
popl %edi
ret
@ -608,7 +608,7 @@
movl 16(%esp), %ebx
movl 20(%esp), %ecx
movl (%esi), %eax
movl 4(%esi), %edx
movl 4(%esi), %edx // %edx:%eax = old value
1:
lock
cmpxchg8b (%esi)
@ -619,25 +619,25 @@
SET_SIZE(atomic_swap_64)
ENTRY(atomic_set_long_excl)
movl 4(%esp), %edx
movl 8(%esp), %ecx
movl 4(%esp), %edx // %edx = target address
movl 8(%esp), %ecx // %ecx = bit id
xorl %eax, %eax
lock
btsl %ecx, (%edx)
jnc 1f
decl %eax
decl %eax // return -1
1:
ret
SET_SIZE(atomic_set_long_excl)
ENTRY(atomic_clear_long_excl)
movl 4(%esp), %edx
movl 8(%esp), %ecx
movl 4(%esp), %edx // %edx = target address
movl 8(%esp), %ecx // %ecx = bit id
xorl %eax, %eax
lock
btrl %ecx, (%edx)
jc 1f
decl %eax
decl %eax // return -1
1:
ret
SET_SIZE(atomic_clear_long_excl)

View File

@ -78,52 +78,52 @@
ENTRY(atomic_inc_8_nv)
ALTENTRY(atomic_inc_uchar_nv)
movb (%rdi), %al
movb (%rdi), %al // %al = old value
1:
leaq 1(%rax), %rcx
leaq 1(%rax), %rcx // %cl = new value
lock
cmpxchgb %cl, (%rdi)
cmpxchgb %cl, (%rdi) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_inc_uchar_nv)
SET_SIZE(atomic_inc_8_nv)
ENTRY(atomic_inc_16_nv)
ALTENTRY(atomic_inc_ushort_nv)
movw (%rdi), %ax
movw (%rdi), %ax // %ax = old value
1:
leaq 1(%rax), %rcx
leaq 1(%rax), %rcx // %cx = new value
lock
cmpxchgw %cx, (%rdi)
cmpxchgw %cx, (%rdi) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_inc_ushort_nv)
SET_SIZE(atomic_inc_16_nv)
ENTRY(atomic_inc_32_nv)
ALTENTRY(atomic_inc_uint_nv)
movl (%rdi), %eax
movl (%rdi), %eax // %eax = old value
1:
leaq 1(%rax), %rcx
leaq 1(%rax), %rcx // %ecx = new value
lock
cmpxchgl %ecx, (%rdi)
cmpxchgl %ecx, (%rdi) // try to stick it in
jne 1b
movl %ecx, %eax
movl %ecx, %eax // return new value
ret
SET_SIZE(atomic_inc_uint_nv)
SET_SIZE(atomic_inc_32_nv)
ENTRY(atomic_inc_64_nv)
ALTENTRY(atomic_inc_ulong_nv)
movq (%rdi), %rax
movq (%rdi), %rax // %rax = old value
1:
leaq 1(%rax), %rcx
leaq 1(%rax), %rcx // %rcx = new value
lock
cmpxchgq %rcx, (%rdi)
cmpxchgq %rcx, (%rdi) // try to stick it in
jne 1b
movq %rcx, %rax
movq %rcx, %rax // return new value
ret
SET_SIZE(atomic_inc_ulong_nv)
SET_SIZE(atomic_inc_64_nv)
@ -162,52 +162,52 @@
ENTRY(atomic_dec_8_nv)
ALTENTRY(atomic_dec_uchar_nv)
movb (%rdi), %al
movb (%rdi), %al // %al = old value
1:
leaq -1(%rax), %rcx
leaq -1(%rax), %rcx // %cl = new value
lock
cmpxchgb %cl, (%rdi)
cmpxchgb %cl, (%rdi) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_dec_uchar_nv)
SET_SIZE(atomic_dec_8_nv)
ENTRY(atomic_dec_16_nv)
ALTENTRY(atomic_dec_ushort_nv)
movw (%rdi), %ax
movw (%rdi), %ax // %ax = old value
1:
leaq -1(%rax), %rcx
leaq -1(%rax), %rcx // %cx = new value
lock
cmpxchgw %cx, (%rdi)
cmpxchgw %cx, (%rdi) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_dec_ushort_nv)
SET_SIZE(atomic_dec_16_nv)
ENTRY(atomic_dec_32_nv)
ALTENTRY(atomic_dec_uint_nv)
movl (%rdi), %eax
movl (%rdi), %eax // %eax = old value
1:
leaq -1(%rax), %rcx
leaq -1(%rax), %rcx // %ecx = new value
lock
cmpxchgl %ecx, (%rdi)
cmpxchgl %ecx, (%rdi) // try to stick it in
jne 1b
movl %ecx, %eax
movl %ecx, %eax // return new value
ret
SET_SIZE(atomic_dec_uint_nv)
SET_SIZE(atomic_dec_32_nv)
ENTRY(atomic_dec_64_nv)
ALTENTRY(atomic_dec_ulong_nv)
movq (%rdi), %rax
movq (%rdi), %rax // %rax = old value
1:
leaq -1(%rax), %rcx
leaq -1(%rax), %rcx // %rcx = new value
lock
cmpxchgq %rcx, (%rdi)
cmpxchgq %rcx, (%rdi) // try to stick it in
jne 1b
movq %rcx, %rax
movq %rcx, %rax // return new value
ret
SET_SIZE(atomic_dec_ulong_nv)
SET_SIZE(atomic_dec_64_nv)
@ -278,28 +278,28 @@
ENTRY(atomic_add_8_nv)
ALTENTRY(atomic_add_char_nv)
movb (%rdi), %al
movb (%rdi), %al // %al = old value
1:
movb %sil, %cl
addb %al, %cl
addb %al, %cl // %cl = new value
lock
cmpxchgb %cl, (%rdi)
cmpxchgb %cl, (%rdi) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_add_char_nv)
SET_SIZE(atomic_add_8_nv)
ENTRY(atomic_add_16_nv)
ALTENTRY(atomic_add_short_nv)
movw (%rdi), %ax
movw (%rdi), %ax // %ax = old value
1:
movw %si, %cx
addw %ax, %cx
addw %ax, %cx // %cx = new value
lock
cmpxchgw %cx, (%rdi)
cmpxchgw %cx, (%rdi) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_add_short_nv)
SET_SIZE(atomic_add_16_nv)
@ -336,28 +336,28 @@
ENTRY(atomic_and_8_nv)
ALTENTRY(atomic_and_uchar_nv)
movb (%rdi), %al
movb (%rdi), %al // %al = old value
1:
movb %sil, %cl
andb %al, %cl
andb %al, %cl // %cl = new value
lock
cmpxchgb %cl, (%rdi)
cmpxchgb %cl, (%rdi) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_and_uchar_nv)
SET_SIZE(atomic_and_8_nv)
ENTRY(atomic_and_16_nv)
ALTENTRY(atomic_and_ushort_nv)
movw (%rdi), %ax
movw (%rdi), %ax // %ax = old value
1:
movw %si, %cx
andw %ax, %cx
andw %ax, %cx // %cx = new value
lock
cmpxchgw %cx, (%rdi)
cmpxchgw %cx, (%rdi) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_and_ushort_nv)
SET_SIZE(atomic_and_16_nv)
@ -392,28 +392,28 @@
ENTRY(atomic_or_8_nv)
ALTENTRY(atomic_or_uchar_nv)
movb (%rdi), %al
movb (%rdi), %al // %al = old value
1:
movb %sil, %cl
orb %al, %cl
orb %al, %cl // %cl = new value
lock
cmpxchgb %cl, (%rdi)
cmpxchgb %cl, (%rdi) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_and_uchar_nv)
SET_SIZE(atomic_and_8_nv)
ENTRY(atomic_or_16_nv)
ALTENTRY(atomic_or_ushort_nv)
movw (%rdi), %ax
movw (%rdi), %ax // %ax = old value
1:
movw %si, %cx
orw %ax, %cx
orw %ax, %cx // %cx = new value
lock
cmpxchgw %cx, (%rdi)
cmpxchgw %cx, (%rdi) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_or_ushort_nv)
SET_SIZE(atomic_or_16_nv)
@ -527,7 +527,7 @@
lock
btsq %rsi, (%rdi)
jnc 1f
decl %eax
decl %eax // return -1
1:
ret
SET_SIZE(atomic_set_long_excl)
@ -537,7 +537,7 @@
lock
btrq %rsi, (%rdi)
jc 1f
decl %eax
decl %eax // return -1
1:
ret
SET_SIZE(atomic_clear_long_excl)

View File

@ -75,28 +75,28 @@
ENTRY(atomic_inc_8_nv)
ALTENTRY(atomic_inc_uchar_nv)
movl 4(%esp), %edx
movb (%edx), %al
movl 4(%esp), %edx // %edx = target address
movb (%edx), %al // %al = old value
1:
leal 1(%eax), %ecx
leal 1(%eax), %ecx // %cl = new value
lock
cmpxchgb %cl, (%edx)
cmpxchgb %cl, (%edx) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_inc_uchar_nv)
SET_SIZE(atomic_inc_8_nv)
ENTRY(atomic_inc_16_nv)
ALTENTRY(atomic_inc_ushort_nv)
movl 4(%esp), %edx
movw (%edx), %ax
movl 4(%esp), %edx // %edx = target address
movw (%edx), %ax // %ax = old value
1:
leal 1(%eax), %ecx
leal 1(%eax), %ecx // %cx = new value
lock
cmpxchgw %cx, (%edx)
cmpxchgw %cx, (%edx) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_inc_ushort_nv)
SET_SIZE(atomic_inc_16_nv)
@ -104,14 +104,14 @@
ENTRY(atomic_inc_32_nv)
ALTENTRY(atomic_inc_uint_nv)
ALTENTRY(atomic_inc_ulong_nv)
movl 4(%esp), %edx
movl (%edx), %eax
movl 4(%esp), %edx // %edx = target address
movl (%edx), %eax // %eax = old value
1:
leal 1(%eax), %ecx
leal 1(%eax), %ecx // %ecx = new value
lock
cmpxchgl %ecx, (%edx)
cmpxchgl %ecx, (%edx) // try to stick it in
jne 1b
movl %ecx, %eax
movl %ecx, %eax // return new value
ret
SET_SIZE(atomic_inc_ulong_nv)
SET_SIZE(atomic_inc_uint_nv)
@ -121,20 +121,20 @@
ALTENTRY(atomic_inc_64_nv)
pushl %edi
pushl %ebx
movl 12(%esp), %edi
movl 12(%esp), %edi // %edi = target address
movl (%edi), %eax
movl 4(%edi), %edx
movl 4(%edi), %edx // %edx:%eax = old value
1:
xorl %ebx, %ebx
xorl %ecx, %ecx
incl %ebx
incl %ebx // %ecx:%ebx = 1
addl %eax, %ebx
adcl %edx, %ecx
adcl %edx, %ecx // add in the carry from inc
lock
cmpxchg8b (%edi)
cmpxchg8b (%edi) // try to stick it in
jne 1b
movl %ebx, %eax
movl %ecx, %edx
movl %ecx, %edx // return new value
popl %ebx
popl %edi
ret
@ -172,28 +172,28 @@
ENTRY(atomic_dec_8_nv)
ALTENTRY(atomic_dec_uchar_nv)
movl 4(%esp), %edx
movb (%edx), %al
movl 4(%esp), %edx // %edx = target address
movb (%edx), %al // %al = old value
1:
leal -1(%eax), %ecx
leal -1(%eax), %ecx // %cl = new value
lock
cmpxchgb %cl, (%edx)
cmpxchgb %cl, (%edx) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_dec_uchar_nv)
SET_SIZE(atomic_dec_8_nv)
ENTRY(atomic_dec_16_nv)
ALTENTRY(atomic_dec_ushort_nv)
movl 4(%esp), %edx
movw (%edx), %ax
movl 4(%esp), %edx // %edx = target address
movw (%edx), %ax // %ax = old value
1:
leal -1(%eax), %ecx
leal -1(%eax), %ecx // %cx = new value
lock
cmpxchgw %cx, (%edx)
cmpxchgw %cx, (%edx) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_dec_ushort_nv)
SET_SIZE(atomic_dec_16_nv)
@ -201,14 +201,14 @@
ENTRY(atomic_dec_32_nv)
ALTENTRY(atomic_dec_uint_nv)
ALTENTRY(atomic_dec_ulong_nv)
movl 4(%esp), %edx
movl (%edx), %eax
movl 4(%esp), %edx // %edx = target address
movl (%edx), %eax // %eax = old value
1:
leal -1(%eax), %ecx
leal -1(%eax), %ecx // %ecx = new value
lock
cmpxchgl %ecx, (%edx)
cmpxchgl %ecx, (%edx) // try to stick it in
jne 1b
movl %ecx, %eax
movl %ecx, %eax // return new value
ret
SET_SIZE(atomic_dec_ulong_nv)
SET_SIZE(atomic_dec_uint_nv)
@ -218,21 +218,21 @@
ALTENTRY(atomic_dec_64_nv)
pushl %edi
pushl %ebx
movl 12(%esp), %edi
movl 12(%esp), %edi // %edi = target address
movl (%edi), %eax
movl 4(%edi), %edx
movl 4(%edi), %edx // %edx:%eax = old value
1:
xorl %ebx, %ebx
xorl %ecx, %ecx
not %ecx
not %ebx
not %ebx // %ecx:%ebx = -1
addl %eax, %ebx
adcl %edx, %ecx
adcl %edx, %ecx // add in the carry from inc
lock
cmpxchg8b (%edi)
cmpxchg8b (%edi) // try to stick it in
jne 1b
movl %ebx, %eax
movl %ecx, %edx
movl %ecx, %edx // return new value
popl %ebx
popl %edi
ret
@ -305,30 +305,30 @@
ENTRY(atomic_add_8_nv)
ALTENTRY(atomic_add_char_nv)
movl 4(%esp), %edx
movb (%edx), %al
movl 4(%esp), %edx // %edx = target address
movb (%edx), %al // %al = old value
1:
movl 8(%esp), %ecx
addb %al, %cl
movl 8(%esp), %ecx // %ecx = delta
addb %al, %cl // %cl = new value
lock
cmpxchgb %cl, (%edx)
cmpxchgb %cl, (%edx) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_add_char_nv)
SET_SIZE(atomic_add_8_nv)
ENTRY(atomic_add_16_nv)
ALTENTRY(atomic_add_short_nv)
movl 4(%esp), %edx
movw (%edx), %ax
movl 4(%esp), %edx // %edx = target address
movw (%edx), %ax // %ax = old value
1:
movl 8(%esp), %ecx
addw %ax, %cx
movl 8(%esp), %ecx // %ecx = delta
addw %ax, %cx // %cx = new value
lock
cmpxchgw %cx, (%edx)
cmpxchgw %cx, (%edx) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_add_short_nv)
SET_SIZE(atomic_add_16_nv)
@ -337,15 +337,15 @@
ALTENTRY(atomic_add_int_nv)
ALTENTRY(atomic_add_ptr_nv)
ALTENTRY(atomic_add_long_nv)
movl 4(%esp), %edx
movl (%edx), %eax
movl 4(%esp), %edx // %edx = target address
movl (%edx), %eax // %eax = old value
1:
movl 8(%esp), %ecx
addl %eax, %ecx
movl 8(%esp), %ecx // %ecx = delta
addl %eax, %ecx // %ecx = new value
lock
cmpxchgl %ecx, (%edx)
cmpxchgl %ecx, (%edx) // try to stick it in
jne 1b
movl %ecx, %eax
movl %ecx, %eax // return new value
ret
SET_SIZE(atomic_add_long_nv)
SET_SIZE(atomic_add_ptr_nv)
@ -356,19 +356,19 @@
ALTENTRY(atomic_add_64_nv)
pushl %edi
pushl %ebx
movl 12(%esp), %edi
movl 12(%esp), %edi // %edi = target address
movl (%edi), %eax
movl 4(%edi), %edx
movl 4(%edi), %edx // %edx:%eax = old value
1:
movl 16(%esp), %ebx
movl 20(%esp), %ecx
movl 20(%esp), %ecx // %ecx:%ebx = delta
addl %eax, %ebx
adcl %edx, %ecx
adcl %edx, %ecx // %ecx:%ebx = new value
lock
cmpxchg8b (%edi)
cmpxchg8b (%edi) // try to stick it in
jne 1b
movl %ebx, %eax
movl %ecx, %edx
movl %ecx, %edx // return new value
popl %ebx
popl %edi
ret
@ -377,30 +377,30 @@
ENTRY(atomic_or_8_nv)
ALTENTRY(atomic_or_uchar_nv)
movl 4(%esp), %edx
movb (%edx), %al
movl 4(%esp), %edx // %edx = target address
movb (%edx), %al // %al = old value
1:
movl 8(%esp), %ecx
orb %al, %cl
movl 8(%esp), %ecx // %ecx = delta
orb %al, %cl // %cl = new value
lock
cmpxchgb %cl, (%edx)
cmpxchgb %cl, (%edx) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_or_uchar_nv)
SET_SIZE(atomic_or_8_nv)
ENTRY(atomic_or_16_nv)
ALTENTRY(atomic_or_ushort_nv)
movl 4(%esp), %edx
movw (%edx), %ax
movl 4(%esp), %edx // %edx = target address
movw (%edx), %ax // %ax = old value
1:
movl 8(%esp), %ecx
orw %ax, %cx
movl 8(%esp), %ecx // %ecx = delta
orw %ax, %cx // %cx = new value
lock
cmpxchgw %cx, (%edx)
cmpxchgw %cx, (%edx) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_or_ushort_nv)
SET_SIZE(atomic_or_16_nv)
@ -408,15 +408,15 @@
ENTRY(atomic_or_32_nv)
ALTENTRY(atomic_or_uint_nv)
ALTENTRY(atomic_or_ulong_nv)
movl 4(%esp), %edx
movl (%edx), %eax
movl 4(%esp), %edx // %edx = target address
movl (%edx), %eax // %eax = old value
1:
movl 8(%esp), %ecx
orl %eax, %ecx
movl 8(%esp), %ecx // %ecx = delta
orl %eax, %ecx // %ecx = new value
lock
cmpxchgl %ecx, (%edx)
cmpxchgl %ecx, (%edx) // try to stick it in
jne 1b
movl %ecx, %eax
movl %ecx, %eax // return new value
ret
SET_SIZE(atomic_or_ulong_nv)
SET_SIZE(atomic_or_uint_nv)
@ -426,19 +426,19 @@
ALTENTRY(atomic_or_64_nv)
pushl %edi
pushl %ebx
movl 12(%esp), %edi
movl 12(%esp), %edi // %edi = target address
movl (%edi), %eax
movl 4(%edi), %edx
movl 4(%edi), %edx // %edx:%eax = old value
1:
movl 16(%esp), %ebx
movl 20(%esp), %ecx
movl 20(%esp), %ecx // %ecx:%ebx = delta
orl %eax, %ebx
orl %edx, %ecx
orl %edx, %ecx // %ecx:%ebx = new value
lock
cmpxchg8b (%edi)
cmpxchg8b (%edi) // try to stick it in
jne 1b
movl %ebx, %eax
movl %ecx, %edx
movl %ecx, %edx // return new value
popl %ebx
popl %edi
ret
@ -447,30 +447,30 @@
ENTRY(atomic_and_8_nv)
ALTENTRY(atomic_and_uchar_nv)
movl 4(%esp), %edx
movb (%edx), %al
movl 4(%esp), %edx // %edx = target address
movb (%edx), %al // %al = old value
1:
movl 8(%esp), %ecx
andb %al, %cl
movl 8(%esp), %ecx // %ecx = delta
andb %al, %cl // %cl = new value
lock
cmpxchgb %cl, (%edx)
cmpxchgb %cl, (%edx) // try to stick it in
jne 1b
movzbl %cl, %eax
movzbl %cl, %eax // return new value
ret
SET_SIZE(atomic_and_uchar_nv)
SET_SIZE(atomic_and_8_nv)
ENTRY(atomic_and_16_nv)
ALTENTRY(atomic_and_ushort_nv)
movl 4(%esp), %edx
movw (%edx), %ax
movl 4(%esp), %edx // %edx = target address
movw (%edx), %ax // %ax = old value
1:
movl 8(%esp), %ecx
andw %ax, %cx
movl 8(%esp), %ecx // %ecx = delta
andw %ax, %cx // %cx = new value
lock
cmpxchgw %cx, (%edx)
cmpxchgw %cx, (%edx) // try to stick it in
jne 1b
movzwl %cx, %eax
movzwl %cx, %eax // return new value
ret
SET_SIZE(atomic_and_ushort_nv)
SET_SIZE(atomic_and_16_nv)
@ -478,15 +478,15 @@
ENTRY(atomic_and_32_nv)
ALTENTRY(atomic_and_uint_nv)
ALTENTRY(atomic_and_ulong_nv)
movl 4(%esp), %edx
movl (%edx), %eax
movl 4(%esp), %edx // %edx = target address
movl (%edx), %eax // %eax = old value
1:
movl 8(%esp), %ecx
andl %eax, %ecx
movl 8(%esp), %ecx // %ecx = delta
andl %eax, %ecx // %ecx = new value
lock
cmpxchgl %ecx, (%edx)
cmpxchgl %ecx, (%edx) // try to stick it in
jne 1b
movl %ecx, %eax
movl %ecx, %eax // return new value
ret
SET_SIZE(atomic_and_ulong_nv)
SET_SIZE(atomic_and_uint_nv)
@ -496,19 +496,19 @@
ALTENTRY(atomic_and_64_nv)
pushl %edi
pushl %ebx
movl 12(%esp), %edi
movl 12(%esp), %edi // %edi = target address
movl (%edi), %eax
movl 4(%edi), %edx
movl 4(%edi), %edx // %edx:%eax = old value
1:
movl 16(%esp), %ebx
movl 20(%esp), %ecx
movl 20(%esp), %ecx // %ecx:%ebx = delta
andl %eax, %ebx
andl %edx, %ecx
andl %edx, %ecx // %ecx:%ebx = new value
lock
cmpxchg8b (%edi)
cmpxchg8b (%edi) // try to stick it in
jne 1b
movl %ebx, %eax
movl %ecx, %edx
movl %ecx, %edx // return new value
popl %ebx
popl %edi
ret
@ -608,7 +608,7 @@
movl 16(%esp), %ebx
movl 20(%esp), %ecx
movl (%esi), %eax
movl 4(%esi), %edx
movl 4(%esi), %edx // %edx:%eax = old value
1:
lock
cmpxchg8b (%esi)
@ -619,25 +619,25 @@
SET_SIZE(atomic_swap_64)
ENTRY(atomic_set_long_excl)
movl 4(%esp), %edx
movl 8(%esp), %ecx
movl 4(%esp), %edx // %edx = target address
movl 8(%esp), %ecx // %ecx = bit id
xorl %eax, %eax
lock
btsl %ecx, (%edx)
jnc 1f
decl %eax
decl %eax // return -1
1:
ret
SET_SIZE(atomic_set_long_excl)
ENTRY(atomic_clear_long_excl)
movl 4(%esp), %edx
movl 8(%esp), %ecx
movl 4(%esp), %edx // %edx = target address
movl 8(%esp), %ecx // %ecx = bit id
xorl %eax, %eax
lock
btrl %ecx, (%edx)
jc 1f
decl %eax
decl %eax // return -1
1:
ret
SET_SIZE(atomic_clear_long_excl)