Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/os_cpu/linux_aarch64/atomic_linux_aarch64.S
41145 views
1
// Copyright (c) 2021, Red Hat Inc. All rights reserved.
2
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3
//
4
// This code is free software; you can redistribute it and/or modify it
5
// under the terms of the GNU General Public License version 2 only, as
6
// published by the Free Software Foundation.
7
//
8
// This code is distributed in the hope that it will be useful, but WITHOUT
9
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11
// version 2 for more details (a copy is included in the LICENSE file that
12
// accompanied this code).
13
//
14
// You should have received a copy of the GNU General Public License version
15
// 2 along with this work; if not, write to the Free Software Foundation,
16
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17
//
18
// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19
// or visit www.oracle.com if you need additional information or have any
20
// questions.
21
22
23
24
.text
25
26
.globl aarch64_atomic_fetch_add_8_default_impl
27
.align 5
28
aarch64_atomic_fetch_add_8_default_impl:
29
prfm pstl1strm, [x0]
30
0: ldaxr x2, [x0]
31
add x8, x2, x1
32
stlxr w9, x8, [x0]
33
cbnz w9, 0b
34
dmb ish
35
mov x0, x2
36
ret
37
38
.globl aarch64_atomic_fetch_add_4_default_impl
39
.align 5
40
aarch64_atomic_fetch_add_4_default_impl:
41
prfm pstl1strm, [x0]
42
0: ldaxr w2, [x0]
43
add w8, w2, w1
44
stlxr w9, w8, [x0]
45
cbnz w9, 0b
46
dmb ish
47
mov w0, w2
48
ret
49
50
.globl aarch64_atomic_xchg_4_default_impl
51
.align 5
52
aarch64_atomic_xchg_4_default_impl:
53
prfm pstl1strm, [x0]
54
0: ldaxr w2, [x0]
55
stlxr w8, w1, [x0]
56
cbnz w8, 0b
57
dmb ish
58
mov w0, w2
59
ret
60
61
.globl aarch64_atomic_xchg_8_default_impl
62
.align 5
63
aarch64_atomic_xchg_8_default_impl:
64
prfm pstl1strm, [x0]
65
0: ldaxr x2, [x0]
66
stlxr w8, x1, [x0]
67
cbnz w8, 0b
68
dmb ish
69
mov x0, x2
70
ret
71
72
.globl aarch64_atomic_cmpxchg_1_default_impl
73
.align 5
74
aarch64_atomic_cmpxchg_1_default_impl:
75
dmb ish
76
prfm pstl1strm, [x0]
77
0: ldxrb w3, [x0]
78
eor w8, w3, w1
79
tst x8, #0xff
80
b.ne 1f
81
stxrb w8, w2, [x0]
82
cbnz w8, 0b
83
1: mov w0, w3
84
dmb ish
85
ret
86
87
.globl aarch64_atomic_cmpxchg_4_default_impl
88
.align 5
89
aarch64_atomic_cmpxchg_4_default_impl:
90
dmb ish
91
prfm pstl1strm, [x0]
92
0: ldxr w3, [x0]
93
cmp w3, w1
94
b.ne 1f
95
stxr w8, w2, [x0]
96
cbnz w8, 0b
97
1: mov w0, w3
98
dmb ish
99
ret
100
101
.globl aarch64_atomic_cmpxchg_8_default_impl
102
.align 5
103
aarch64_atomic_cmpxchg_8_default_impl:
104
dmb ish
105
prfm pstl1strm, [x0]
106
0: ldxr x3, [x0]
107
cmp x3, x1
108
b.ne 1f
109
stxr w8, x2, [x0]
110
cbnz w8, 0b
111
1: mov x0, x3
112
dmb ish
113
ret
114
115
.globl aarch64_atomic_cmpxchg_1_relaxed_default_impl
116
.align 5
117
aarch64_atomic_cmpxchg_1_relaxed_default_impl:
118
prfm pstl1strm, [x0]
119
0: ldxrb w3, [x0]
120
eor w8, w3, w1
121
tst x8, #0xff
122
b.ne 1f
123
stxrb w8, w2, [x0]
124
cbnz w8, 0b
125
1: mov w0, w3
126
ret
127
128
.globl aarch64_atomic_cmpxchg_4_relaxed_default_impl
129
.align 5
130
aarch64_atomic_cmpxchg_4_relaxed_default_impl:
131
prfm pstl1strm, [x0]
132
0: ldxr w3, [x0]
133
cmp w3, w1
134
b.ne 1f
135
stxr w8, w2, [x0]
136
cbnz w8, 0b
137
1: mov w0, w3
138
ret
139
140
.globl aarch64_atomic_cmpxchg_8_relaxed_default_impl
141
.align 5
142
aarch64_atomic_cmpxchg_8_relaxed_default_impl:
143
prfm pstl1strm, [x0]
144
0: ldxr x3, [x0]
145
cmp x3, x1
146
b.ne 1f
147
stxr w8, x2, [x0]
148
cbnz w8, 0b
149
1: mov x0, x3
150
ret
151
152