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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
35;
extern "C" char __rw_atomic_xchg8 (
char *
x,
char y);
37; Atomically assigns the 8-bit
value y to *
x and returns
38; the original (before assignment) 8-bit
value of *
x.
39;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
42 public ___rw_atomic_xchg8
43___rw_atomic_xchg8 proc ; char (
char *
x,
char y)
48 mov ecx, [esp+arg_x] ; %ecx =
x
49 mov al, [esp+arg_y] ; %al =
y
50 xchg al, [ecx] ; %al <-> (%ecx)
52___rw_atomic_xchg8 endp
55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56;
extern "C" short __rw_atomic_xchg16 (
short *
x,
short y);
58; Atomically assigns the 16-bit
value y to *
x and returns
59; the original (before assignment) 16-bit
value of *
x.
60;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
63 public ___rw_atomic_xchg16
64___rw_atomic_xchg16 proc ; short (
short *
x,
short y)
69 mov ecx, [esp+arg_x] ; %ecx =
x
70 mov ax, [esp+arg_y] ; %eax =
y
71 xchg ax, [ecx] ; %ax <-> (%ecx)
73___rw_atomic_xchg16 endp
76;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
77;
extern "C" int __rw_atomic_xchg32 (
int *
x,
int y);
79; Atomically assigns the 32-bit
value y to *
x and returns
80; the original (before assignment) 32-bit
value of *
x.
81;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
84 public ___rw_atomic_xchg32
85___rw_atomic_xchg32 proc ; int (
int *
x,
int y)
90 mov ecx, [esp+arg_x] ; %ecx =
x
91 mov eax, [esp+arg_y] ; %eax =
y
92 xchg eax, [ecx] ; %eax <-> (%ecx)
94___rw_atomic_xchg32 endp
98;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
99;
extern "C" char __rw_atomic_add8 (
char *
x,
int y);
101; Atomically increments the 8-bit
value *
x by
y and returns
102; the
new (after increment) 8-bit
value of *
x.
103;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
106 public ___rw_atomic_add8
107___rw_atomic_add8 proc ; char (
char *dst,
int inc)
112 mov ecx, [esp+arg_dst] ; %ecx = dst
113 mov eax, [esp+arg_inc] ; %eax = inc
116 lock xadd [ecx], al ;
tmp = *dst;
120 add eax, edx ;
return %eax + inc
122___rw_atomic_add8 endp
125;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
126;
extern "C" short __rw_atomic_add16 (
short *
x,
short y);
128; Atomically increments the 16-bit
value *
x by
y and returns
129; the
new (after increment) 16-bit
value of *
x.
130;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
133 public ___rw_atomic_add16
134___rw_atomic_add16 proc ; short (
short *dst,
short inc)
139 mov ecx, [esp+arg_dst] ; %ecx = dst
140 mov eax, [esp+arg_inc] ; %eax = inc
143 lock xadd [ecx], ax ;
tmp = *dst;
147 add eax, edx ;
return %eax + inc
149___rw_atomic_add16 endp
152;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
153;
extern "C" int __rw_atomic_add32 (
int *
x,
int y);
155; Atomically increments the 32-bit
value *
x by
y and returns
156; the
new (after increment) 32-bit
value of *
x.
157;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
160 public ___rw_atomic_add32
161___rw_atomic_add32 proc ; int (
int *dst,
int inc)
166 mov ecx, [esp+arg_dst] ; %ecx = dst
167 mov edx, [esp+arg_inc] ; %edx = inc
170 lock xadd [ecx], eax ;
tmp = *dst;
174 add eax, edx ;
return %eax + inc
176___rw_atomic_add32 endp