nsprpub/pr/src/md/os2/os2emx.s

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

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

mercurial