Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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_x86_AtomicIncrement(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_x86_AtomicIncrement |
michael@0 | 14 | .align 4 |
michael@0 | 15 | _PR_x86_AtomicIncrement: |
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_x86_AtomicDecrement(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_x86_AtomicDecrement |
michael@0 | 30 | .align 4 |
michael@0 | 31 | _PR_x86_AtomicDecrement: |
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_x86_AtomicSet(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_x86_AtomicSet |
michael@0 | 47 | // .align 4 |
michael@0 | 48 | //_PR_x86_AtomicSet: |
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_x86_AtomicSet |
michael@0 | 60 | .align 4 |
michael@0 | 61 | _PR_x86_AtomicSet: |
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_x86_AtomicAdd(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_x86_AtomicAdd |
michael@0 | 74 | .align 4 |
michael@0 | 75 | _PR_x86_AtomicAdd: |
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 |
michael@0 | 83 | |
michael@0 | 84 | // Magic indicating no need for an executable stack |
michael@0 | 85 | .section .note.GNU-stack, "", @progbits ; .previous |