blob: 5832f6d15c2666ac0bdfda1afaec2f15cbcf994d [file] [log] [blame]
Shenghou Ma37aba1a2013-02-13 01:00:04 +08001// Copyright 2013 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4//
5// System calls and other sys.stuff for ARM, NetBSD
6// /usr/src/sys/kern/syscalls.master for syscall numbers.
7//
8
Russ Cox15ced2d2014-11-11 17:06:22 -05009#include "go_asm.h"
10#include "go_tls.h"
Russ Coxcb040d52014-09-04 23:05:18 -040011#include "textflag.h"
Shenghou Ma37aba1a2013-02-13 01:00:04 +080012
13// Exit the entire program (like C exit)
Keith Randall0273dc12013-08-07 12:20:05 -070014TEXT runtime·exit(SB),NOSPLIT,$-4
Russ Coxc72a2112015-02-23 10:56:10 -050015 MOVW code+0(FP), R0 // arg 1 exit status
Shenghou Ma37aba1a2013-02-13 01:00:04 +080016 SWI $0xa00001
Shenghou Mad8fd8d82013-05-28 20:13:02 +080017 MOVW.CS $0, R8 // crash on syscall failure
18 MOVW.CS R8, (R8)
Shenghou Ma37aba1a2013-02-13 01:00:04 +080019 RET
20
Keith Randall0273dc12013-08-07 12:20:05 -070021TEXT runtime·exit1(SB),NOSPLIT,$-4
Shenghou Ma37aba1a2013-02-13 01:00:04 +080022 SWI $0xa00136 // sys__lwp_exit
Shenghou Mad8fd8d82013-05-28 20:13:02 +080023 MOVW $1, R8 // crash
24 MOVW R8, (R8)
Shenghou Ma37aba1a2013-02-13 01:00:04 +080025 RET
Shenghou Mae7537152013-03-19 02:47:04 +080026
Keith Randall0273dc12013-08-07 12:20:05 -070027TEXT runtime·open(SB),NOSPLIT,$-8
Russ Coxc72a2112015-02-23 10:56:10 -050028 MOVW name+0(FP), R0
29 MOVW mode+4(FP), R1
30 MOVW perm+8(FP), R2
Shenghou Mae7537152013-03-19 02:47:04 +080031 SWI $0xa00005
Keith Randallf584c052015-03-02 20:16:48 -080032 MOVW.CS $-1, R0
Russ Cox25f6b022014-08-27 11:32:17 -040033 MOVW R0, ret+12(FP)
Shenghou Mae7537152013-03-19 02:47:04 +080034 RET
35
David Crawshawcea272d2015-04-13 19:37:04 -040036TEXT runtime·closefd(SB),NOSPLIT,$-8
Russ Coxc72a2112015-02-23 10:56:10 -050037 MOVW fd+0(FP), R0
Shenghou Mae7537152013-03-19 02:47:04 +080038 SWI $0xa00006
Keith Randallf584c052015-03-02 20:16:48 -080039 MOVW.CS $-1, R0
Russ Cox25f6b022014-08-27 11:32:17 -040040 MOVW R0, ret+4(FP)
Shenghou Mae7537152013-03-19 02:47:04 +080041 RET
42
Keith Randall0273dc12013-08-07 12:20:05 -070043TEXT runtime·read(SB),NOSPLIT,$-8
Russ Coxc72a2112015-02-23 10:56:10 -050044 MOVW fd+0(FP), R0
45 MOVW p+4(FP), R1
46 MOVW n+8(FP), R2
Shenghou Mae7537152013-03-19 02:47:04 +080047 SWI $0xa00003
Keith Randallf584c052015-03-02 20:16:48 -080048 MOVW.CS $-1, R0
Russ Cox25f6b022014-08-27 11:32:17 -040049 MOVW R0, ret+12(FP)
Shenghou Mae7537152013-03-19 02:47:04 +080050 RET
Shenghou Ma37aba1a2013-02-13 01:00:04 +080051
Keith Randall0273dc12013-08-07 12:20:05 -070052TEXT runtime·write(SB),NOSPLIT,$-4
Russ Coxc72a2112015-02-23 10:56:10 -050053 MOVW fd+0(FP), R0 // arg 1 - fd
54 MOVW p+4(FP), R1 // arg 2 - buf
55 MOVW n+8(FP), R2 // arg 3 - nbyte
Shenghou Ma37aba1a2013-02-13 01:00:04 +080056 SWI $0xa00004 // sys_write
Keith Randallf584c052015-03-02 20:16:48 -080057 MOVW.CS $-1, R0
Russ Cox25f6b022014-08-27 11:32:17 -040058 MOVW R0, ret+12(FP)
Shenghou Ma37aba1a2013-02-13 01:00:04 +080059 RET
60
61// int32 lwp_create(void *context, uintptr flags, void *lwpid)
Keith Randall0273dc12013-08-07 12:20:05 -070062TEXT runtime·lwp_create(SB),NOSPLIT,$0
Russ Cox25f6b022014-08-27 11:32:17 -040063 MOVW ctxt+0(FP), R0
Shenghou Ma37aba1a2013-02-13 01:00:04 +080064 MOVW flags+4(FP), R1
65 MOVW lwpid+8(FP), R2
66 SWI $0xa00135 // sys__lwp_create
Russ Cox25f6b022014-08-27 11:32:17 -040067 MOVW R0, ret+12(FP)
Shenghou Ma37aba1a2013-02-13 01:00:04 +080068 RET
69
Keith Randall0273dc12013-08-07 12:20:05 -070070TEXT runtime·osyield(SB),NOSPLIT,$0
Shenghou Ma37aba1a2013-02-13 01:00:04 +080071 SWI $0xa0015e // sys_sched_yield
72 RET
73
Keith Randall0273dc12013-08-07 12:20:05 -070074TEXT runtime·lwp_park(SB),NOSPLIT,$0
Russ Coxc72a2112015-02-23 10:56:10 -050075 MOVW abstime+0(FP), R0 // arg 1 - abstime
76 MOVW unpark+4(FP), R1 // arg 2 - unpark
77 MOVW hint+8(FP), R2 // arg 3 - hint
78 MOVW unparkhint+12(FP), R3 // arg 4 - unparkhint
Shenghou Ma37aba1a2013-02-13 01:00:04 +080079 SWI $0xa001b2 // sys__lwp_park
Russ Cox25f6b022014-08-27 11:32:17 -040080 MOVW R0, ret+16(FP)
Shenghou Ma37aba1a2013-02-13 01:00:04 +080081 RET
82
Keith Randall0273dc12013-08-07 12:20:05 -070083TEXT runtime·lwp_unpark(SB),NOSPLIT,$0
Russ Coxc72a2112015-02-23 10:56:10 -050084 MOVW lwp+0(FP), R0 // arg 1 - lwp
85 MOVW hint+4(FP), R1 // arg 2 - hint
Shenghou Ma37aba1a2013-02-13 01:00:04 +080086 SWI $0xa00141 // sys__lwp_unpark
Russ Cox25f6b022014-08-27 11:32:17 -040087 MOVW R0, ret+8(FP)
Shenghou Ma37aba1a2013-02-13 01:00:04 +080088 RET
89
Keith Randall0273dc12013-08-07 12:20:05 -070090TEXT runtime·lwp_self(SB),NOSPLIT,$0
Shenghou Ma37aba1a2013-02-13 01:00:04 +080091 SWI $0xa00137 // sys__lwp_self
Russ Cox25f6b022014-08-27 11:32:17 -040092 MOVW R0, ret+0(FP)
Shenghou Ma37aba1a2013-02-13 01:00:04 +080093 RET
94
Keith Randall0273dc12013-08-07 12:20:05 -070095TEXT runtime·lwp_tramp(SB),NOSPLIT,$0
Russ Cox89f185f2014-06-26 11:54:39 -040096 MOVW R0, g_m(R1)
Shenghou Mad8fd8d82013-05-28 20:13:02 +080097 MOVW R1, g
Shenghou Ma37aba1a2013-02-13 01:00:04 +080098
99 BL runtime·emptyfunc(SB) // fault if stack check is wrong
100 BL (R2)
Shenghou Mad8fd8d82013-05-28 20:13:02 +0800101 MOVW $2, R8 // crash (not reached)
102 MOVW R8, (R8)
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800103 RET
104
Keith Randall0273dc12013-08-07 12:20:05 -0700105TEXT runtime·usleep(SB),NOSPLIT,$16
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800106 MOVW usec+0(FP), R0
107 MOVW R0, R2
108 MOVW $1000000, R1
109 DIV R1, R0
110 // 0(R13) is the saved LR, don't use it
111 MOVW R0, 4(R13) // tv_sec.low
112 MOVW $0, R0
113 MOVW R0, 8(R13) // tv_sec.high
114 MOD R1, R2
115 MOVW $1000, R1
116 MUL R1, R2
117 MOVW R2, 12(R13) // tv_nsec
118
119 MOVW $4(R13), R0 // arg 1 - rqtp
120 MOVW $0, R1 // arg 2 - rmtp
121 SWI $0xa001ae // sys_nanosleep
122 RET
123
Keith Randall0273dc12013-08-07 12:20:05 -0700124TEXT runtime·raise(SB),NOSPLIT,$16
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800125 SWI $0xa00137 // sys__lwp_self, the returned R0 is arg 1
Russ Cox5146a932013-03-15 01:11:03 -0400126 MOVW sig+0(FP), R1 // arg 2 - signal
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800127 SWI $0xa0013e // sys__lwp_kill
128 RET
129
Keith Randall0273dc12013-08-07 12:20:05 -0700130TEXT runtime·setitimer(SB),NOSPLIT,$-4
Russ Coxc72a2112015-02-23 10:56:10 -0500131 MOVW mode+0(FP), R0 // arg 1 - which
132 MOVW new+4(FP), R1 // arg 2 - itv
133 MOVW old+8(FP), R2 // arg 3 - oitv
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800134 SWI $0xa001a9 // sys_setitimer
135 RET
136
137// func now() (sec int64, nsec int32)
Keith Randall0273dc12013-08-07 12:20:05 -0700138TEXT time·now(SB), NOSPLIT, $32
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800139 MOVW $0, R0 // CLOCK_REALTIME
140 MOVW $8(R13), R1
141 SWI $0xa001ab // clock_gettime
142
143 MOVW 8(R13), R0 // sec.low
144 MOVW 12(R13), R1 // sec.high
145 MOVW 16(R13), R2 // nsec
146
Russ Coxc72a2112015-02-23 10:56:10 -0500147 MOVW R0, sec_lo+0(FP)
148 MOVW R1, sec_hi+4(FP)
149 MOVW R2, nsec+8(FP)
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800150 RET
151
152// int64 nanotime(void) so really
153// void nanotime(int64 *nsec)
Keith Randall0273dc12013-08-07 12:20:05 -0700154TEXT runtime·nanotime(SB), NOSPLIT, $32
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800155 MOVW $0, R0 // CLOCK_REALTIME
156 MOVW $8(R13), R1
157 SWI $0xa001ab // clock_gettime
158
159 MOVW 8(R13), R0 // sec.low
160 MOVW 12(R13), R4 // sec.high
161 MOVW 16(R13), R2 // nsec
162
163 MOVW $1000000000, R3
164 MULLU R0, R3, (R1, R0)
165 MUL R3, R4
166 ADD.S R2, R0
167 ADC R4, R1
168
Russ Cox25f6b022014-08-27 11:32:17 -0400169 MOVW R0, ret_lo+0(FP)
170 MOVW R1, ret_hi+4(FP)
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800171 RET
172
Keith Randall0273dc12013-08-07 12:20:05 -0700173TEXT runtime·getcontext(SB),NOSPLIT,$-4
Russ Coxc72a2112015-02-23 10:56:10 -0500174 MOVW ctxt+0(FP), R0 // arg 1 - context
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800175 SWI $0xa00133 // sys_getcontext
Shenghou Mad8fd8d82013-05-28 20:13:02 +0800176 MOVW.CS $0, R8 // crash on syscall failure
177 MOVW.CS R8, (R8)
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800178 RET
179
Keith Randall0273dc12013-08-07 12:20:05 -0700180TEXT runtime·sigprocmask(SB),NOSPLIT,$0
Russ Coxc72a2112015-02-23 10:56:10 -0500181 MOVW mode+0(FP), R0 // arg 1 - how
182 MOVW new+4(FP), R1 // arg 2 - set
183 MOVW old+8(FP), R2 // arg 3 - oset
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800184 SWI $0xa00125 // sys_sigprocmask
Shenghou Mad8fd8d82013-05-28 20:13:02 +0800185 MOVW.CS $0, R8 // crash on syscall failure
186 MOVW.CS R8, (R8)
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800187 RET
188
Keith Randall0273dc12013-08-07 12:20:05 -0700189TEXT runtime·sigreturn_tramp(SB),NOSPLIT,$-4
Shenghou Mae5551722013-07-03 00:33:38 +0800190 // on entry, SP points to siginfo, we add sizeof(ucontext)
191 // to SP to get a pointer to ucontext.
192 ADD $0x80, R13, R0 // 0x80 == sizeof(UcontextT)
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800193 SWI $0xa00134 // sys_setcontext
194 // something failed, we have to exit
195 MOVW $0x4242, R0 // magic return number
196 SWI $0xa00001 // sys_exit
197 B -2(PC) // continue exit
198
Keith Randall0273dc12013-08-07 12:20:05 -0700199TEXT runtime·sigaction(SB),NOSPLIT,$4
Russ Coxc72a2112015-02-23 10:56:10 -0500200 MOVW sig+0(FP), R0 // arg 1 - signum
201 MOVW new+4(FP), R1 // arg 2 - nsa
202 MOVW old+8(FP), R2 // arg 3 - osa
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800203 MOVW $runtime·sigreturn_tramp(SB), R3 // arg 4 - tramp
204 MOVW $2, R4 // arg 5 - vers
205 MOVW R4, 4(R13)
206 ADD $4, R13 // pass arg 5 on stack
207 SWI $0xa00154 // sys___sigaction_sigtramp
208 SUB $4, R13
Shenghou Mad8fd8d82013-05-28 20:13:02 +0800209 MOVW.CS $3, R8 // crash on syscall failure
210 MOVW.CS R8, (R8)
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800211 RET
212
Keith Randall0273dc12013-08-07 12:20:05 -0700213TEXT runtime·sigtramp(SB),NOSPLIT,$24
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800214 // this might be called in external code context,
Russ Cox89f185f2014-06-26 11:54:39 -0400215 // where g is not set.
216 // first save R0, because runtime·load_g will clobber it
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800217 MOVW R0, 4(R13) // signum
Elias Naur48c0d8b2013-08-14 13:18:32 -0400218 MOVB runtime·iscgo(SB), R0
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800219 CMP $0, R0
Russ Cox89f185f2014-06-26 11:54:39 -0400220 BL.NE runtime·load_g(SB)
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800221
Russ Cox89f185f2014-06-26 11:54:39 -0400222 CMP $0, g
Shenghou Ma2f1ead72013-07-12 04:39:39 +0800223 BNE 4(PC)
Shenghou Maae73b902013-05-27 20:46:53 +0800224 // signal number is already prepared in 4(R13)
Shenghou Ma2f1ead72013-07-12 04:39:39 +0800225 MOVW $runtime·badsignal(SB), R11
226 BL (R11)
Shenghou Maae73b902013-05-27 20:46:53 +0800227 RET
228
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800229 // save g
Shenghou Mad8fd8d82013-05-28 20:13:02 +0800230 MOVW g, R4
231 MOVW g, 20(R13)
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800232
233 // g = m->signal
Russ Cox89f185f2014-06-26 11:54:39 -0400234 MOVW g_m(g), R8
235 MOVW m_gsignal(R8), g
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800236
237 // R0 is already saved
238 MOVW R1, 8(R13) // info
239 MOVW R2, 12(R13) // context
240 MOVW R4, 16(R13) // gp
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800241
242 BL runtime·sighandler(SB)
243
244 // restore g
Shenghou Mad8fd8d82013-05-28 20:13:02 +0800245 MOVW 20(R13), g
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800246 RET
247
Keith Randall0273dc12013-08-07 12:20:05 -0700248TEXT runtime·mmap(SB),NOSPLIT,$12
Russ Coxc72a2112015-02-23 10:56:10 -0500249 MOVW addr+0(FP), R0 // arg 1 - addr
250 MOVW n+4(FP), R1 // arg 2 - len
251 MOVW prot+8(FP), R2 // arg 3 - prot
252 MOVW flags+12(FP), R3 // arg 4 - flags
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800253 // arg 5 (fid) and arg6 (offset_lo, offset_hi) are passed on stack
254 // note the C runtime only passes the 32-bit offset_lo to us
Russ Coxc72a2112015-02-23 10:56:10 -0500255 MOVW fd+16(FP), R4 // arg 5
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800256 MOVW R4, 4(R13)
Russ Coxc72a2112015-02-23 10:56:10 -0500257 MOVW off+20(FP), R5 // arg 6 lower 32-bit
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800258 MOVW R5, 8(R13)
259 MOVW $0, R6 // higher 32-bit for arg 6
260 MOVW R6, 12(R13)
261 ADD $4, R13 // pass arg 5 and arg 6 on stack
262 SWI $0xa000c5 // sys_mmap
263 SUB $4, R13
Russ Cox25f6b022014-08-27 11:32:17 -0400264 MOVW R0, ret+24(FP)
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800265 RET
266
Keith Randall0273dc12013-08-07 12:20:05 -0700267TEXT runtime·munmap(SB),NOSPLIT,$0
Russ Coxc72a2112015-02-23 10:56:10 -0500268 MOVW addr+0(FP), R0 // arg 1 - addr
269 MOVW n+4(FP), R1 // arg 2 - len
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800270 SWI $0xa00049 // sys_munmap
Shenghou Mad8fd8d82013-05-28 20:13:02 +0800271 MOVW.CS $0, R8 // crash on syscall failure
272 MOVW.CS R8, (R8)
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800273 RET
274
Keith Randall0273dc12013-08-07 12:20:05 -0700275TEXT runtime·madvise(SB),NOSPLIT,$0
Russ Coxc72a2112015-02-23 10:56:10 -0500276 MOVW addr+0(FP), R0 // arg 1 - addr
277 MOVW n+4(FP), R1 // arg 2 - len
278 MOVW flags+8(FP), R2 // arg 3 - behav
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800279 SWI $0xa0004b // sys_madvise
280 // ignore failure - maybe pages are locked
281 RET
282
Keith Randall0273dc12013-08-07 12:20:05 -0700283TEXT runtime·sigaltstack(SB),NOSPLIT,$-4
Russ Coxc72a2112015-02-23 10:56:10 -0500284 MOVW new+0(FP), R0 // arg 1 - nss
285 MOVW old+4(FP), R1 // arg 2 - oss
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800286 SWI $0xa00119 // sys___sigaltstack14
Shenghou Mad8fd8d82013-05-28 20:13:02 +0800287 MOVW.CS $0, R8 // crash on syscall failure
288 MOVW.CS R8, (R8)
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800289 RET
290
Keith Randall0273dc12013-08-07 12:20:05 -0700291TEXT runtime·sysctl(SB),NOSPLIT,$8
Russ Coxc72a2112015-02-23 10:56:10 -0500292 MOVW mib+0(FP), R0 // arg 1 - name
293 MOVW miblen+4(FP), R1 // arg 2 - namelen
294 MOVW out+8(FP), R2 // arg 3 - oldp
295 MOVW size+12(FP), R3 // arg 4 - oldlenp
296 MOVW dst+16(FP), R4 // arg 5 - newp
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800297 MOVW R4, 4(R13)
Russ Coxc72a2112015-02-23 10:56:10 -0500298 MOVW ndst+20(FP), R4 // arg 6 - newlen
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800299 MOVW R4, 8(R13)
300 ADD $4, R13 // pass arg 5 and 6 on stack
301 SWI $0xa000ca // sys___sysctl
302 SUB $4, R13
Russ Cox25f6b022014-08-27 11:32:17 -0400303 MOVW R0, ret+24(FP)
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800304 RET
305
Mikio Harac4cdd352013-08-17 12:11:29 +0900306// int32 runtime·kqueue(void)
307TEXT runtime·kqueue(SB),NOSPLIT,$0
308 SWI $0xa00158 // sys_kqueue
309 RSB.CS $0, R0
Russ Cox25f6b022014-08-27 11:32:17 -0400310 MOVW R0, ret+0(FP)
Mikio Harac4cdd352013-08-17 12:11:29 +0900311 RET
312
313// int32 runtime·kevent(int kq, Kevent *changelist, int nchanges, Kevent *eventlist, int nevents, Timespec *timeout)
314TEXT runtime·kevent(SB),NOSPLIT,$8
Russ Coxc72a2112015-02-23 10:56:10 -0500315 MOVW kq+0(FP), R0 // kq
316 MOVW ch+4(FP), R1 // changelist
317 MOVW nch+8(FP), R2 // nchanges
318 MOVW ev+12(FP), R3 // eventlist
319 MOVW nev+16(FP), R4 // nevents
Mikio Harac4cdd352013-08-17 12:11:29 +0900320 MOVW R4, 4(R13)
Russ Coxc72a2112015-02-23 10:56:10 -0500321 MOVW ts+20(FP), R4 // timeout
Mikio Harac4cdd352013-08-17 12:11:29 +0900322 MOVW R4, 8(R13)
323 ADD $4, R13 // pass arg 5 and 6 on stack
324 SWI $0xa001b3 // sys___kevent50
325 RSB.CS $0, R0
326 SUB $4, R13
Russ Cox25f6b022014-08-27 11:32:17 -0400327 MOVW R0, ret+24(FP)
Mikio Harac4cdd352013-08-17 12:11:29 +0900328 RET
329
330// void runtime·closeonexec(int32 fd)
331TEXT runtime·closeonexec(SB),NOSPLIT,$0
Russ Coxc72a2112015-02-23 10:56:10 -0500332 MOVW fd+0(FP), R0 // fd
Mikio Harac4cdd352013-08-17 12:11:29 +0900333 MOVW $2, R1 // F_SETFD
334 MOVW $1, R2 // FD_CLOEXEC
335 SWI $0xa0005c // sys_fcntl
336 RET
337
Russ Cox15ced2d2014-11-11 17:06:22 -0500338TEXT runtime·casp1(SB),NOSPLIT,$0
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800339 B runtime·cas(SB)
340
341// TODO(minux): this is only valid for ARMv6+
342// bool armcas(int32 *val, int32 old, int32 new)
343// Atomically:
344// if(*val == old){
345// *val = new;
346// return 1;
347// }else
348// return 0;
Keith Randall0273dc12013-08-07 12:20:05 -0700349TEXT runtime·cas(SB),NOSPLIT,$0
Shenghou Ma37aba1a2013-02-13 01:00:04 +0800350 B runtime·armcas(SB)
Elias Naur45233732013-08-14 15:38:54 +0000351
Austin Clementsf5d494b2015-06-15 12:30:23 -0400352// TODO: this is only valid for ARMv7+
353TEXT ·publicationBarrier(SB),NOSPLIT,$-4-0
354 B runtime·armPublicationBarrier(SB)
355
Elias Naur45233732013-08-14 15:38:54 +0000356TEXT runtime·read_tls_fallback(SB),NOSPLIT,$-4
357 MOVM.WP [R1, R2, R3, R12], (R13)
358 SWI $0x00a0013c // _lwp_getprivate
359 MOVM.IAW (R13), [R1, R2, R3, R12]
360 RET