tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

os_Darwin_x86.s (1939B)


      1 # -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
      2 #
      3 # This Source Code Form is subject to the terms of the Mozilla Public
      4 # License, v. 2.0. If a copy of the MPL was not distributed with this
      5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
      6 
      7 #
      8 # Based on os_Linux_x86.s
      9 #
     10 
     11 #
     12 # PRInt32 __PR_Darwin_x86_AtomicIncrement(PRInt32 *val);
     13 #
     14 # Atomically increment the integer pointed to by 'val' and return
     15 # the result of the increment.
     16 #
     17    .text
     18    .globl __PR_Darwin_x86_AtomicIncrement
     19    .private_extern __PR_Darwin_x86_AtomicIncrement
     20    .align 4
     21 __PR_Darwin_x86_AtomicIncrement:
     22    movl 4(%esp), %ecx
     23    movl $1, %eax
     24    lock
     25    xaddl %eax, (%ecx)
     26    incl %eax
     27    ret
     28 
     29 #
     30 # PRInt32 __PR_Darwin_x86_AtomicDecrement(PRInt32 *val);
     31 #
     32 # Atomically decrement the integer pointed to by 'val' and return
     33 # the result of the decrement.
     34 #
     35    .text
     36    .globl __PR_Darwin_x86_AtomicDecrement
     37    .private_extern __PR_Darwin_x86_AtomicDecrement
     38    .align 4
     39 __PR_Darwin_x86_AtomicDecrement:
     40    movl 4(%esp), %ecx
     41    movl $-1, %eax
     42    lock
     43    xaddl %eax, (%ecx)
     44    decl %eax
     45    ret
     46 
     47 #
     48 # PRInt32 __PR_Darwin_x86_AtomicSet(PRInt32 *val, PRInt32 newval);
     49 #
     50 # Atomically set the integer pointed to by 'val' to the new
     51 # value 'newval' and return the old value.
     52 #
     53    .text
     54    .globl __PR_Darwin_x86_AtomicSet
     55    .private_extern __PR_Darwin_x86_AtomicSet
     56    .align 4
     57 __PR_Darwin_x86_AtomicSet:
     58    movl 4(%esp), %ecx
     59    movl 8(%esp), %eax
     60    xchgl %eax, (%ecx)
     61    ret
     62 
     63 #
     64 # PRInt32 __PR_Darwin_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val);
     65 #
     66 # Atomically add 'val' to the integer pointed to by 'ptr'
     67 # and return the result of the addition.
     68 #
     69    .text
     70    .globl __PR_Darwin_x86_AtomicAdd
     71    .private_extern __PR_Darwin_x86_AtomicAdd
     72    .align 4
     73 __PR_Darwin_x86_AtomicAdd:
     74    movl 4(%esp), %ecx
     75    movl 8(%esp), %eax
     76    movl %eax, %edx
     77    lock
     78    xaddl %eax, (%ecx)
     79    addl %edx, %eax
     80    ret