Wed, 31 Dec 2014 07:53:36 +0100
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 | .text |
michael@0 | 8 | |
michael@0 | 9 | .globl getedi |
michael@0 | 10 | getedi: |
michael@0 | 11 | movl %edi,%eax |
michael@0 | 12 | ret |
michael@0 | 13 | .type getedi,@function |
michael@0 | 14 | .size getedi,.-getedi |
michael@0 | 15 | |
michael@0 | 16 | .globl setedi |
michael@0 | 17 | setedi: |
michael@0 | 18 | movl 4(%esp),%edi |
michael@0 | 19 | ret |
michael@0 | 20 | .type setedi,@function |
michael@0 | 21 | .size setedi,.-setedi |
michael@0 | 22 | |
michael@0 | 23 | .globl __MD_FlushRegisterWindows |
michael@0 | 24 | .globl _MD_FlushRegisterWindows |
michael@0 | 25 | |
michael@0 | 26 | __MD_FlushRegisterWindows: |
michael@0 | 27 | _MD_FlushRegisterWindows: |
michael@0 | 28 | |
michael@0 | 29 | ret |
michael@0 | 30 | |
michael@0 | 31 | // |
michael@0 | 32 | // sol_getsp() |
michael@0 | 33 | // |
michael@0 | 34 | // Return the current sp (for debugging) |
michael@0 | 35 | // |
michael@0 | 36 | .globl sol_getsp |
michael@0 | 37 | sol_getsp: |
michael@0 | 38 | movl %esp, %eax |
michael@0 | 39 | ret |
michael@0 | 40 | |
michael@0 | 41 | // |
michael@0 | 42 | // sol_curthread() |
michael@0 | 43 | // |
michael@0 | 44 | // Return a unique identifier for the currently active thread. |
michael@0 | 45 | // |
michael@0 | 46 | .globl sol_curthread |
michael@0 | 47 | sol_curthread: |
michael@0 | 48 | movl %ecx, %eax |
michael@0 | 49 | ret |
michael@0 | 50 | |
michael@0 | 51 | // PRInt32 _MD_AtomicIncrement(PRInt32 *val) |
michael@0 | 52 | // |
michael@0 | 53 | // Atomically increment the integer pointed to by 'val' and return |
michael@0 | 54 | // the result of the increment. |
michael@0 | 55 | // |
michael@0 | 56 | .text |
michael@0 | 57 | .globl _MD_AtomicIncrement |
michael@0 | 58 | .align 4 |
michael@0 | 59 | _MD_AtomicIncrement: |
michael@0 | 60 | movl 4(%esp), %ecx |
michael@0 | 61 | movl $1, %eax |
michael@0 | 62 | lock |
michael@0 | 63 | xaddl %eax, (%ecx) |
michael@0 | 64 | incl %eax |
michael@0 | 65 | ret |
michael@0 | 66 | |
michael@0 | 67 | // PRInt32 _MD_AtomicDecrement(PRInt32 *val) |
michael@0 | 68 | // |
michael@0 | 69 | // Atomically decrement the integer pointed to by 'val' and return |
michael@0 | 70 | // the result of the decrement. |
michael@0 | 71 | // |
michael@0 | 72 | .text |
michael@0 | 73 | .globl _MD_AtomicDecrement |
michael@0 | 74 | .align 4 |
michael@0 | 75 | _MD_AtomicDecrement: |
michael@0 | 76 | movl 4(%esp), %ecx |
michael@0 | 77 | movl $-1, %eax |
michael@0 | 78 | lock |
michael@0 | 79 | xaddl %eax, (%ecx) |
michael@0 | 80 | decl %eax |
michael@0 | 81 | ret |
michael@0 | 82 | |
michael@0 | 83 | // PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval) |
michael@0 | 84 | // |
michael@0 | 85 | // Atomically set the integer pointed to by 'val' to the new |
michael@0 | 86 | // value 'newval' and return the old value. |
michael@0 | 87 | // |
michael@0 | 88 | // An alternative implementation: |
michael@0 | 89 | // .text |
michael@0 | 90 | // .globl _MD_AtomicSet |
michael@0 | 91 | // .align 4 |
michael@0 | 92 | //_MD_AtomicSet: |
michael@0 | 93 | // movl 4(%esp), %ecx |
michael@0 | 94 | // movl 8(%esp), %edx |
michael@0 | 95 | // movl (%ecx), %eax |
michael@0 | 96 | //retry: |
michael@0 | 97 | // lock |
michael@0 | 98 | // cmpxchgl %edx, (%ecx) |
michael@0 | 99 | // jne retry |
michael@0 | 100 | // ret |
michael@0 | 101 | // |
michael@0 | 102 | .text |
michael@0 | 103 | .globl _MD_AtomicSet |
michael@0 | 104 | .align 4 |
michael@0 | 105 | _MD_AtomicSet: |
michael@0 | 106 | movl 4(%esp), %ecx |
michael@0 | 107 | movl 8(%esp), %eax |
michael@0 | 108 | xchgl %eax, (%ecx) |
michael@0 | 109 | ret |
michael@0 | 110 | |
michael@0 | 111 | // PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val) |
michael@0 | 112 | // |
michael@0 | 113 | // Atomically add 'val' to the integer pointed to by 'ptr' |
michael@0 | 114 | // and return the result of the addition. |
michael@0 | 115 | // |
michael@0 | 116 | .text |
michael@0 | 117 | .globl _MD_AtomicAdd |
michael@0 | 118 | .align 4 |
michael@0 | 119 | _MD_AtomicAdd: |
michael@0 | 120 | movl 4(%esp), %ecx |
michael@0 | 121 | movl 8(%esp), %eax |
michael@0 | 122 | movl %eax, %edx |
michael@0 | 123 | lock |
michael@0 | 124 | xaddl %eax, (%ecx) |
michael@0 | 125 | addl %edx, %eax |
michael@0 | 126 | ret |