1 // Copyright 2012 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 package atomic 6 7 func loadUint64(addr *uint64) (val uint64) { 8 for { 9 val = *addr 10 if CompareAndSwapUint64(addr, val, val) { 11 break 12 } 13 } 14 return 15 } 16 17 func storeUint64(addr *uint64, val uint64) { 18 for { 19 old := *addr 20 if CompareAndSwapUint64(addr, old, val) { 21 break 22 } 23 } 24 return 25 } 26 27 func addUint64(val *uint64, delta uint64) (new uint64) { 28 for { 29 old := *val 30 new = old + delta 31 if CompareAndSwapUint64(val, old, new) { 32 break 33 } 34 } 35 return 36 } 37 38 func swapUint64(addr *uint64, new uint64) (old uint64) { 39 for { 40 old = *addr 41 if CompareAndSwapUint64(addr, old, new) { 42 break 43 } 44 } 45 return 46 } 47 48 // Additional ARM-specific assembly routines. 49 // Declaration here to give assembly routines correct stack maps for arguments. 50 func armCompareAndSwapUint32(addr *uint32, old, new uint32) (swapped bool) 51 func armCompareAndSwapUint64(addr *uint64, old, new uint64) (swapped bool) 52 func generalCAS64(addr *uint64, old, new uint64) (swapped bool) 53 func armAddUint32(addr *uint32, delta uint32) (new uint32) 54 func armAddUint64(addr *uint64, delta uint64) (new uint64) 55 func armSwapUint32(addr *uint32, new uint32) (old uint32) 56 func armSwapUint64(addr *uint64, new uint64) (old uint64) 57 func armLoadUint64(addr *uint64) (val uint64) 58 func armStoreUint64(addr *uint64, val uint64) 59