1/* SPDX-License-Identifier: BSD-2-Clause */ 2/* 3 * Copyright (c) 2015-2016, Linaro Limited 4 * All rights reserved. 5 */ 6 7#include <asm.S> 8 9 10/* uint32_t atomic_inc32(uint32_t *v); */ 11FUNC atomic_inc32 , : 12 ldaxr w1, [x0] 13 add w1, w1, #1 14 stxr w2, w1, [x0] 15 cmp w2, #0 16 bne atomic_inc32 17 mov w0, w1 18 ret 19END_FUNC atomic_inc32 20 21/* uint32_t atomic_dec32(uint32_t *v); */ 22FUNC atomic_dec32 , : 23 ldaxr w1, [x0] 24 sub w1, w1, #1 25 stxr w2, w1, [x0] 26 cmp w2, #0 27 bne atomic_dec32 28 mov w0, w1 29 ret 30END_FUNC atomic_dec32 31 32