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