diff options
author | wtc%netscape.com <devnull@localhost> | 2000-04-25 22:33:10 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2000-04-25 22:33:10 +0000 |
commit | 743a4fa3fd904482151b17b8b8b628d20893d291 (patch) | |
tree | ac344fe1d98ed4452d74cc793dfa8daa3b5bfc55 | |
parent | ef2f02ba2dd05ccb59230e9933a2f272a91d2fb0 (diff) | |
download | nspr-hg-743a4fa3fd904482151b17b8b8b628d20893d291.tar.gz |
Bugzilla bug #30902: added an alternative implementation of PR_AtomicSet
using cmpxchg in the comments. Made PR_AtomicAdd a little more efficient.
-rw-r--r-- | pr/src/md/unix/os_Linux_x86.s | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/pr/src/md/unix/os_Linux_x86.s b/pr/src/md/unix/os_Linux_x86.s index 83008948..f72f28d2 100644 --- a/pr/src/md/unix/os_Linux_x86.s +++ b/pr/src/md/unix/os_Linux_x86.s @@ -53,6 +53,20 @@ _PR_x86_AtomicDecrement: / Atomically set the integer pointed to by 'val' to the new / value 'newval' and return the old value. / +/ An alternative implementation: +/ .text +/ .globl _PR_x86_AtomicSet +/ .align 4 +/_PR_x86_AtomicSet: +/ movl 4(%esp), %ecx +/ movl 8(%esp), %edx +/ movl (%ecx), %eax +/retry: +/ lock +/ cmpxchgl %edx, (%ecx) +/ jne retry +/ ret +/ .text .globl _PR_x86_AtomicSet .align 4 @@ -74,7 +88,7 @@ _PR_x86_AtomicSet: _PR_x86_AtomicAdd: movl 4(%esp), %ecx movl 8(%esp), %eax - movl 8(%esp), %edx + movl %eax, %edx lock xaddl %eax, (%ecx) addl %edx, %eax |