1 /* kernel atomic64 operations
3 * For an explanation of how atomic ops work in this arch, see:
4 * Documentation/frv/atomic-ops.txt
6 * Copyright (C) 2009 Red Hat, Inc. All Rights Reserved.
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
15 #include <asm/spr-regs.h>
21 ###############################################################################
23 # uint64_t __xchg_64(uint64_t i, uint64_t *v)
25 ###############################################################################
27 .type __xchg_64,@function
32 orcc gr0,gr0,gr0,icc3 /* set ICC3.Z */
34 ldd.p @(gr10,gr0),gr8 /* LDD.P/ORCR must be atomic */
35 orcr cc7,cc7,cc3 /* set CC3 to true */
36 cstd.p gr4,@(gr10,gr0) ,cc3,#1
37 corcc gr29,gr29,gr0 ,cc3,#1 /* clear ICC3.Z if store happens */
41 .size __xchg_64, .-__xchg_64
43 ###############################################################################
45 # uint64_t __cmpxchg_64(uint64_t test, uint64_t new, uint64_t *v)
47 ###############################################################################
49 .type __cmpxchg_64,@function
54 orcc gr0,gr0,gr0,icc3 /* set ICC3.Z */
56 ldd.p @(gr12,gr0),gr8 /* LDD.P/ORCR must be atomic */
58 subcc gr8,gr4,gr0,icc0
59 subcc.p gr9,gr5,gr0,icc1
62 cstd.p gr10,@(gr12,gr0) ,cc3,#1
63 corcc gr29,gr29,gr0 ,cc3,#1 /* clear ICC3.Z if store happens */
67 .size __cmpxchg_64, .-__cmpxchg_64