github.com/primecitizens/pcz/std@v0.2.1/core/atomic/sys_nonlinux_arm.s (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 // 4 // Copyright 2015 The Go Authors. All rights reserved. 5 // Use of this source code is governed by a BSD-style 6 // license that can be found in the LICENSE file. 7 8 //go:build arm && !linux 9 10 #include "textflag.h" 11 12 // TODO(minux): this is only valid for ARMv6+ 13 // bool armcas(int32 *val, int32 old, int32 new) 14 // Atomically: 15 // if(*val == old){ 16 // *val = new; 17 // return 1; 18 // }else 19 // return 0; 20 TEXT ·Cas(SB),NOSPLIT,$0 21 JMP ·armcas(SB) 22 23 // Non-linux OSes support only single processor machines before ARMv7. 24 // So we don't need memory barriers if goarm < 7. And we fail loud at 25 // startup (runtime.checkgoarm) if it is a multi-processor but goarm < 7. 26 27 TEXT ·Load32(SB),NOSPLIT|NOFRAME,$0-8 28 MOVW addr+0(FP), R0 29 MOVW (R0), R1 30 31 MOVB runtime·goarm(SB), R11 32 CMP $7, R11 33 BLT 2(PC) 34 DMB MB_ISH 35 36 MOVW R1, ret+4(FP) 37 RET 38 39 TEXT ·Store(SB),NOSPLIT,$0-8 40 MOVW addr+0(FP), R1 41 MOVW v+4(FP), R2 42 43 MOVB runtime·goarm(SB), R8 44 CMP $7, R8 45 BLT 2(PC) 46 DMB MB_ISH 47 48 MOVW R2, (R1) 49 50 CMP $7, R8 51 BLT 2(PC) 52 DMB MB_ISH 53 RET 54 55 TEXT ·Load8(SB),NOSPLIT|NOFRAME,$0-5 56 MOVW addr+0(FP), R0 57 MOVB (R0), R1 58 59 MOVB runtime·goarm(SB), R11 60 CMP $7, R11 61 BLT 2(PC) 62 DMB MB_ISH 63 64 MOVB R1, ret+4(FP) 65 RET 66 67 TEXT ·Store8(SB),NOSPLIT,$0-5 68 MOVW addr+0(FP), R1 69 MOVB v+4(FP), R2 70 71 MOVB runtime·goarm(SB), R8 72 CMP $7, R8 73 BLT 2(PC) 74 DMB MB_ISH 75 76 MOVB R2, (R1) 77 78 CMP $7, R8 79 BLT 2(PC) 80 DMB MB_ISH 81 RET 82