VirtualBox

Ignore:
Timestamp:
Dec 18, 2009 3:19:41 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56161
Message:

iprt/asm.h: Adding ASMAtomicCmpXchgU8, ASMAtomicCmpXchgS8 and ASMAtomicCmpXchgBool.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/asm/ASMAtomicCmpXchgU8.asm

    r25486 r25490  
    11; $Id$
    22;; @file
    3 ; IPRT - ASMAtomicCmpXchgU64().
     3; IPRT - ASMAtomicCmpXchgU8().
    44;
    55
     
    3737
    3838;;
    39 ; Atomically compares and exchanges an unsigned 64-bit int.
     39; Atomically compares and exchanges an unsigned 8-bit int.
    4040;
    41 ; @param    pu64     x86:ebp+8
    42 ; @param    u64New   x86:ebp+c
    43 ; @param    u64Old   x86:ebp+14
     41; @param    pu8     x86:esp+4  msc:rcx  gcc:rdi
     42; @param    u8New   x86:esp+8  msc:dl   gcc:sil
     43; @param    u8Old   x86:esp+c  msc:r8l  gcc:dl
    4444;
    4545; @returns  bool result: true if succesfully exchanged, false if not.
    4646;           x86:al
    4747;
    48 BEGINPROC_EXPORTED ASMAtomicCmpXchgU64
    49 %ifndef RT_ARCH_X86
    50  %error port me
     48BEGINPROC_EXPORTED ASMAtomicCmpXchgU8
     49%ifdef RT_ARCH_AMD64
     50 %ifdef ASM_CALL64_MSC
     51        mov     al, r8l
     52        lock cmpxchg [rcx], dl
     53 %else
     54        mov     al, dl
     55        lock cmpxchg [rdi], sil
     56 %endif
     57%else
     58        mov     ecx, [esp + 04h]
     59        mov     dl,  [esp + 08h]
     60        mov     al,  [esp + 0ch]
     61        lock cmpxchg [ecx], dl
    5162%endif
    52         push    ebp
    53         mov     ebp, esp
    54         push    ebx
    55         push    edi
    56 
    57         mov     ebx, dword [ebp+0ch]
    58         mov     ecx, dword [ebp+0ch + 4]
    59         mov     edi, [ebp+08h]
    60         mov     eax, dword [ebp+14h]
    61         mov     edx, dword [ebp+14h + 4]
    62         lock cmpxchg8b [edi]
    6363        setz    al
    6464        movzx   eax, al
     65        ret
     66ENDPROC ASMAtomicCmpXchgU8
    6567
    66         pop     edi
    67         pop     ebx
    68         leave
    69         ret
    70 ENDPROC ASMAtomicCmpXchgU64
    71 
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette