Black Lives Matter. Support the Equal Justice Initiative.

Text file src/runtime/internal/atomic/sys_nonlinux_arm.s

Documentation: runtime/internal/atomic

     1  // Copyright 2015 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  //go:build !linux
     6  // +build !linux
     7  
     8  #include "textflag.h"
     9  
    10  // TODO(minux): this is only valid for ARMv6+
    11  // bool armcas(int32 *val, int32 old, int32 new)
    12  // Atomically:
    13  //	if(*val == old){
    14  //		*val = new;
    15  //		return 1;
    16  //	}else
    17  //		return 0;
    18  TEXT	·Cas(SB),NOSPLIT,$0
    19  	JMP	·armcas(SB)
    20  
    21  // Non-linux OSes support only single processor machines before ARMv7.
    22  // So we don't need memory barriers if goarm < 7. And we fail loud at
    23  // startup (runtime.checkgoarm) if it is a multi-processor but goarm < 7.
    24  
    25  TEXT	·Load(SB),NOSPLIT|NOFRAME,$0-8
    26  	MOVW	addr+0(FP), R0
    27  	MOVW	(R0), R1
    28  
    29  	MOVB	runtime·goarm(SB), R11
    30  	CMP	$7, R11
    31  	BLT	2(PC)
    32  	DMB	MB_ISH
    33  
    34  	MOVW	R1, ret+4(FP)
    35  	RET
    36  
    37  TEXT	·Store(SB),NOSPLIT,$0-8
    38  	MOVW	addr+0(FP), R1
    39  	MOVW	v+4(FP), R2
    40  
    41  	MOVB	runtime·goarm(SB), R8
    42  	CMP	$7, R8
    43  	BLT	2(PC)
    44  	DMB	MB_ISH
    45  
    46  	MOVW	R2, (R1)
    47  
    48  	CMP	$7, R8
    49  	BLT	2(PC)
    50  	DMB	MB_ISH
    51  	RET
    52  
    53  TEXT	·Load8(SB),NOSPLIT|NOFRAME,$0-5
    54  	MOVW	addr+0(FP), R0
    55  	MOVB	(R0), R1
    56  
    57  	MOVB	runtime·goarm(SB), R11
    58  	CMP	$7, R11
    59  	BLT	2(PC)
    60  	DMB	MB_ISH
    61  
    62  	MOVB	R1, ret+4(FP)
    63  	RET
    64  
    65  TEXT	·Store8(SB),NOSPLIT,$0-5
    66  	MOVW	addr+0(FP), R1
    67  	MOVB	v+4(FP), R2
    68  
    69  	MOVB	runtime·goarm(SB), R8
    70  	CMP	$7, R8
    71  	BLT	2(PC)
    72  	DMB	MB_ISH
    73  
    74  	MOVB	R2, (R1)
    75  
    76  	CMP	$7, R8
    77  	BLT	2(PC)
    78  	DMB	MB_ISH
    79  	RET
    80  
    81  

View as plain text