ASMAtomicCmpXchgU64.asm revision 16f8846540385a2be120c7430c1b61ce938c718b
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; $Id$
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync;; @file
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; IPRT - ASMAtomicCmpXchgU64().
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync;
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync;
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; Copyright (C) 2006-2009 Sun Microsystems, Inc.
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync;
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; This file is part of VirtualBox Open Source Edition (OSE), as
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; available from http://www.virtualbox.org. This file is free software;
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; you can redistribute it and/or modify it under the terms of the GNU
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; General Public License (GPL) as published by the Free Software
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; Foundation, in version 2 as it comes in the "COPYING" file of the
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
f34e9be461cc7d7f0f06db370616c136ae359fbevboxsync;
f34e9be461cc7d7f0f06db370616c136ae359fbevboxsync; The contents of this file may alternatively be used under the terms
f34e9be461cc7d7f0f06db370616c136ae359fbevboxsync; of the Common Development and Distribution License Version 1.0
f34e9be461cc7d7f0f06db370616c136ae359fbevboxsync; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
f34e9be461cc7d7f0f06db370616c136ae359fbevboxsync; VirtualBox OSE distribution, in which case the provisions of the
f34e9be461cc7d7f0f06db370616c136ae359fbevboxsync; CDDL are applicable instead of those of the GPL.
f34e9be461cc7d7f0f06db370616c136ae359fbevboxsync;
f34e9be461cc7d7f0f06db370616c136ae359fbevboxsync; You may elect to license modified versions of this file under the
f34e9be461cc7d7f0f06db370616c136ae359fbevboxsync; terms and conditions of either the GPL or the CDDL or both.
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync;
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; Clara, CA 95054 USA or visit http://www.sun.com if you need
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; additional information or have any questions.
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync;
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync;*******************************************************************************
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync;* Header Files *
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync;*******************************************************************************
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync%include "iprt/asmdefs.mac"
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync
afc71ee9d14313aac9881860b235a74d7c8a683evboxsyncBEGINCODE
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync;;
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; Atomically compares and exchanges an unsigned 64-bit int.
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync;
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; @param pu64 x86:ebp+8
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync; @param u64New x86:ebp+c
c36d095531b5355dba93be3b9b862bac18148109vboxsync; @param u64Old x86:ebp+14
c36d095531b5355dba93be3b9b862bac18148109vboxsync;
c36d095531b5355dba93be3b9b862bac18148109vboxsync; @returns bool result: true if succesfully exchanged, false if not.
c36d095531b5355dba93be3b9b862bac18148109vboxsync; x86:al
c36d095531b5355dba93be3b9b862bac18148109vboxsync;
afc71ee9d14313aac9881860b235a74d7c8a683evboxsyncBEGINPROC_EXPORTED ASMAtomicCmpXchgU64
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync%ifndef RT_ARCH_X86
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync %error port me
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync%endif
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync push ebp
866306ba031a2f258907507dd4abb3b84b6983e7vboxsync mov ebp, esp
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync push ebx
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync push edi
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync mov ebx, dword [ebp+0ch]
afc71ee9d14313aac9881860b235a74d7c8a683evboxsync mov ecx, dword [ebp+0ch + 4]
866306ba031a2f258907507dd4abb3b84b6983e7vboxsync mov edi, [ebp+08h]
866306ba031a2f258907507dd4abb3b84b6983e7vboxsync mov eax, dword [ebp+14h]
866306ba031a2f258907507dd4abb3b84b6983e7vboxsync mov edx, dword [ebp+14h + 4]
866306ba031a2f258907507dd4abb3b84b6983e7vboxsync lock cmpxchg8b [edi]
866306ba031a2f258907507dd4abb3b84b6983e7vboxsync setz al
866306ba031a2f258907507dd4abb3b84b6983e7vboxsync movzx eax, al
866306ba031a2f258907507dd4abb3b84b6983e7vboxsync
866306ba031a2f258907507dd4abb3b84b6983e7vboxsync pop edi
866306ba031a2f258907507dd4abb3b84b6983e7vboxsync pop ebx
866306ba031a2f258907507dd4abb3b84b6983e7vboxsync leave
866306ba031a2f258907507dd4abb3b84b6983e7vboxsync ret
866306ba031a2f258907507dd4abb3b84b6983e7vboxsyncENDPROC ASMAtomicCmpXchgU64
866306ba031a2f258907507dd4abb3b84b6983e7vboxsync
866306ba031a2f258907507dd4abb3b84b6983e7vboxsync