1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9; Licensed to the Apache Software Foundation (ASF) under
one or more
10; contributor license agreements. See the NOTICE file distributed
11; with
this work
for additional information regarding copyright
12; ownership. The ASF licenses
this file to you under the Apache
13; License, Version 2.0 (the
"License"); you may not use
this file
14; except
in compliance with the License. You may obtain
a copy of
19; Unless required by applicable law or agreed to
in writing, software
20; distributed under the License is distributed on an
"AS IS" BASIS,
21; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
22; implied. See the License
for the specific language governing
23; permissions and limitations under the License.
25; Copyright 2003-2006 Rogue Wave Software.
27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
32;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
33;
extern "C" int8_t __rw_atomic_xchg8 (int8_t *
x, int8_t
y);
35; Atomically assigns the 8-bit
value y to *
x and returns
36; the original (before assignment) 8-bit
value of *
x.
37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
40 public __rw_atomic_xchg8
41__rw_atomic_xchg8 proc ; int8_t (int8_t *
x, int8_t
y)
44 xchg al, [rcx] ; %al <-> (%rcx)
49;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
50;
extern "C" int16_t __rw_atomic_xchg16 (int16_t *
x, int16_t
y);
52; Atomically assigns the 16-bit
value y to *
x and returns
53; the original (before assignment) 16-bit
value of *
x.
54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
57 public __rw_atomic_xchg16
58__rw_atomic_xchg16 proc ; int16_t (int16_t *
x, int16_t
y)
61 xchg ax, [rcx] ; %ax <-> (%rcx)
63__rw_atomic_xchg16 endp
66;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
67;
extern "C" int32_t __rw_atomic_xchg32 (int32_t *
x, int32_t
y);
69; Atomically assigns the 32-bit
value y to *
x and returns
70; the original (before assignment) 32-bit
value of *
x.
71;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
74 public __rw_atomic_xchg32
75__rw_atomic_xchg32 proc ; int32_t (int32_t *
x, int32_t
y)
77 mov eax, edx ; %eax =
y
78 xchg eax, [rcx] ; %eax <-> (%rcx)
80__rw_atomic_xchg32 endp
83;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
84;
extern "C" int32_t __rw_atomic_xchg64 (int64_t *
x, int64_t
y);
86; Atomically assigns the 64-bit
value y to *
x and returns
87; the original (before assignment) 64-bit
value of *
x.
88;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
91 public __rw_atomic_xchg64
92__rw_atomic_xchg64 proc ; int64_t (int64_t *
x, int64_t
y)
94 mov rax, rdx ; %rax =
y
95 xchg rax, [rcx] ; %rax <-> (%rcx)
97__rw_atomic_xchg64 endp
100;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
101;
extern "C" int8_t __rw_atomic_add8 (int8_t *
x, int8_t
y);
103; Atomically increments the 8-bit
value *
x by
y and returns
104; the
new (after increment) 8-bit
value of *
x.
105;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
108 public __rw_atomic_add8
109__rw_atomic_add8 proc ; int8_t (int8_t *dst, int8_t inc)
111 mov eax, edx ; %eax = inc
113 lock xadd [rcx], al ;
tmp = *dst
116 add eax, edx ;
return %al + inc
121;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
122;
extern "C" int16_t __rw_atomic_add16 (int16_t *
x, int16_t
y);
124; Atomically increments the 16-bit
value *
x by
y and returns
125; the
new (after increment) 16-bit
value of *
x.
126;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
129 public __rw_atomic_add16
130__rw_atomic_add16 proc ; int16_t (int16_t *dst, int16_t inc)
132 mov ax, dx ; %ax = inc
134 lock xadd [rcx], ax ;
tmp = *dst
138 add ax, dx ;
return %ax + inc
140__rw_atomic_add16 endp
143;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
144;
extern "C" int32_t __rw_atomic_add32 (int32_t *
x, int32_t
y);
146; Atomically increments the 32-bit
value *
x by
y and returns
147; the
new (after increment) 32-bit
value of *
x.
148;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
151 public __rw_atomic_add32
152__rw_atomic_add32 proc ; int32_t (int32_t *dst, int32_t inc)
154 mov eax, edx ; %eax = inc
156 lock xadd [rcx], eax ;
tmp = *dst
160 add eax, edx ;
return %eax + inc
162__rw_atomic_add32 endp
165;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
166;
extern "C" int64_t __rw_atomic_add64 (int64_t *
x, int64_t
y);
168; Atomically increments the 32-bit
value *
x by
y and returns
169; the
new (after increment) 32-bit
value of *
x.
170;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
173 public __rw_atomic_add64
174__rw_atomic_add64 proc ; int64_t (int64_t *dst, int64_t inc)
176 mov rax, rdx ; %eax = inc
178 lock xadd [rcx], rax ;
tmp = *dst
182 add rax, rdx ;
return %eax + inc
184__rw_atomic_add64 endp