[ros-bugs] [Bug 6223] PATCH: i386 ExInterlockedAddLargeStatistic broken
ReactOS.Bugzilla at reactos.org
ReactOS.Bugzilla at reactos.org
Fri May 6 10:14:15 UTC 2011
http://www.reactos.org/bugzilla/show_bug.cgi?id=6223
--- Comment #2 from bonzini <bonzini at gnu.org> 2011-05-06 10:14:15 CET ---
My code is broken too, though it's simply because it doesn't preserve ebx. :)
Fixed version:
push ebx
push ebp
mov ebp, ecx
Again:
mov eax, [ebp] ;; Load comparand in eax for cmpxchg
mov ebx, edx ;; Compute low word of the result in ebx
add ebx, eax
jc Slow ;; Carry needs cmpxchg8b
;; Fast path still needs to be atomic, so use cmpxchg and retry if it fails
;; Hopefully it will still get through this path :)
lock cmpxchg [ecx], ebx
jnz Again
pop ebp
pop ebx
ret
Slow:
push edx ;; save increment across cmpxchg8b
mov edx, [ebp+4] ;; finish loading comparand in edx:eax
lea ecx, [edx+1] ;; result in ecx:ebx (we know there's carry)
lock cmpxchg8b [ebp]
pop edx
jnz Again
pop ebp
pop ebx
ret
--
Configure bugmail: http://www.reactos.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the Ros-bugs
mailing list