~martin-decky/helenos/rcu

« back to all changes in this revision

Viewing changes to kernel/arch/arm32/include/atomic.h

  • Committer: Pavel Rimsky
  • Date: 2010-02-20 20:54:53 UTC
  • mfrom: (292 head)
  • mto: This revision was merged to the branch mainline in revision 296.
  • Revision ID: pavel@pavel-laptop-20100220205453-70sim280j709dgp3
Synchronize with head.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 * @return Value after addition.
47
47
 *
48
48
 */
49
 
static inline long atomic_add(atomic_t *val, int i)
 
49
static inline atomic_count_t atomic_add(atomic_t *val, atomic_count_t i)
50
50
{
51
 
        long ret;
52
 
 
53
51
        /*
54
52
         * This implementation is for UP pre-ARMv6 systems where we do not have
55
53
         * the LDREX and STREX instructions.
56
54
         */
57
55
        ipl_t ipl = interrupts_disable();
58
56
        val->count += i;
59
 
        ret = val->count;
 
57
        atomic_count_t ret = val->count;
60
58
        interrupts_restore(ipl);
61
59
        
62
60
        return ret;
65
63
/** Atomic increment.
66
64
 *
67
65
 * @param val Variable to be incremented.
 
66
 *
68
67
 */
69
68
static inline void atomic_inc(atomic_t *val)
70
69
{
74
73
/** Atomic decrement.
75
74
 *
76
75
 * @param val Variable to be decremented.
 
76
 *
77
77
 */
78
78
static inline void atomic_dec(atomic_t *val) {
79
79
        atomic_add(val, -1);
83
83
 *
84
84
 * @param val Variable to be incremented.
85
85
 * @return    Value after incrementation.
 
86
 *
86
87
 */
87
 
static inline long atomic_preinc(atomic_t *val)
 
88
static inline atomic_count_t atomic_preinc(atomic_t *val)
88
89
{
89
90
        return atomic_add(val, 1);
90
91
}
93
94
 *
94
95
 * @param val Variable to be decremented.
95
96
 * @return    Value after decrementation.
 
97
 *
96
98
 */
97
 
static inline long atomic_predec(atomic_t *val)
 
99
static inline atomic_count_t atomic_predec(atomic_t *val)
98
100
{
99
101
        return atomic_add(val, -1);
100
102
}
103
105
 *
104
106
 * @param val Variable to be incremented.
105
107
 * @return    Value before incrementation.
 
108
 *
106
109
 */
107
 
static inline long atomic_postinc(atomic_t *val)
 
110
static inline atomic_count_t atomic_postinc(atomic_t *val)
108
111
{
109
112
        return atomic_add(val, 1) - 1;
110
113
}
113
116
 *
114
117
 * @param val Variable to be decremented.
115
118
 * @return    Value before decrementation.
 
119
 *
116
120
 */
117
 
static inline long atomic_postdec(atomic_t *val)
 
121
static inline atomic_count_t atomic_postdec(atomic_t *val)
118
122
{
119
123
        return atomic_add(val, -1) + 1;
120
124
}