...

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

View as plain text