#include <asm_defs.h>
.text
FUNCTION(atomic_set):
movl 4(%esp), %edx
movl 8(%esp), %eax
lock
addl $0, (%esp)
movl %eax, (%edx)
ret
FUNCTION_END(atomic_set)
FUNCTION(atomic_get_and_set):
movl 4(%esp), %edx
movl 8(%esp), %eax
xchg %eax, (%edx)
ret
FUNCTION_END(atomic_get_and_set)
FUNCTION(atomic_test_and_set):
movl 4(%esp), %edx
movl 8(%esp), %ecx
movl 12(%esp), %eax
lock
cmpxchgl %ecx, (%edx)
ret
FUNCTION_END(atomic_test_and_set)
FUNCTION(atomic_add):
movl 4(%esp), %edx
movl 8(%esp), %eax
lock
xaddl %eax, (%edx)
ret
FUNCTION_END(atomic_add)
FUNCTION(atomic_and):
movl 4(%esp), %edx
1:
movl 8(%esp), %ecx
movl (%edx), %eax
andl %eax, %ecx
lock
cmpxchgl %ecx, (%edx)
jnz 1b
ret
FUNCTION_END(atomic_and)
FUNCTION(atomic_or):
movl 4(%esp), %edx
1:
movl 8(%esp), %ecx
movl (%edx), %eax
orl %eax, %ecx
lock
cmpxchgl %ecx, (%edx)
jnz 1b
ret
FUNCTION_END(atomic_or)
FUNCTION(atomic_get):
movl 4(%esp), %edx
movl (%edx), %eax
lock
addl $0, (%esp)
ret
FUNCTION_END(atomic_get)
FUNCTION(atomic_set64):
push %esi
push %ebx
movl 12(%esp), %esi
movl 16(%esp), %ebx
movl 20(%esp), %ecx
1:
movl (%esi), %eax
movl 4(%esi), %edx
lock
cmpxchg8b (%esi)
jnz 1b
pop %ebx
pop %esi
ret
FUNCTION_END(atomic_set64)
FUNCTION(atomic_get_and_set64):
push %esi
push %ebx
movl 12(%esp), %esi
movl 16(%esp), %ebx
movl 20(%esp), %ecx
1:
movl (%esi), %eax
movl 4(%esi), %edx
lock
cmpxchg8b (%esi)
jnz 1b
pop %ebx
pop %esi
ret
FUNCTION_END(atomic_get_and_set64)
FUNCTION(atomic_test_and_set64):
push %esi
push %ebx
movl 12(%esp), %esi
movl 16(%esp), %ebx
movl 20(%esp), %ecx
movl 24(%esp), %eax
movl 28(%esp), %edx
lock
cmpxchg8b (%esi)
pop %ebx
pop %esi
ret
FUNCTION_END(atomic_test_and_set64)
FUNCTION(atomic_add64):
push %esi
push %ebx
movl 12(%esp), %esi
1:
movl (%esi), %eax
movl 4(%esi), %edx
movl %eax, %ebx
movl %edx, %ecx
addl 16(%esp), %ebx
adcl 20(%esp), %ecx
lock
cmpxchg8b (%esi)
jnz 1b
pop %ebx
pop %esi
ret
FUNCTION_END(atomic_add64)
FUNCTION(atomic_and64):
push %esi
push %ebx
movl 12(%esp), %esi
1:
movl (%esi), %eax
movl 4(%esi), %edx
movl %eax, %ebx
movl %edx, %ecx
andl 16(%esp), %ebx
andl 20(%esp), %ecx
lock
cmpxchg8b (%esi)
jnz 1b
pop %ebx
pop %esi
ret
FUNCTION_END(atomic_and64)
FUNCTION(atomic_or64):
push %esi
push %ebx
movl 12(%esp), %esi
1:
movl (%esi), %eax
movl 4(%esi), %edx
movl %eax, %ebx
movl %edx, %ecx
orl 16(%esp), %ebx
orl 20(%esp), %ecx
lock
cmpxchg8b (%esi)
jnz 1b
pop %ebx
pop %esi
ret
FUNCTION_END(atomic_or64)
FUNCTION(atomic_get64):
push %esi
push %ebx
movl 12(%esp), %esi
1:
movl (%esi), %eax
movl 4(%esi), %edx
movl %eax, %ebx
movl %edx, %ecx
lock
cmpxchg8b (%esi)
jnz 1b
pop %ebx
pop %esi
ret
FUNCTION_END(atomic_get64)