~ubuntu-branches/ubuntu/vivid/musl/vivid

« back to all changes in this revision

Viewing changes to arch/powerpc/atomic.h

  • Committer: Package Import Robot
  • Author(s): Kevin Bortis
  • Date: 2014-05-26 22:45:52 UTC
  • mfrom: (4.1.4 sid)
  • Revision ID: package-import@ubuntu.com-20140526224552-qrtsct934q29xo0x
Tags: 1.1.4-1
* Import upstream version 1.1.4. (Closes: #754758)
* Fixes possible stack-based buffer overflow CVE-2014-3484 (Closes: #750815) 
* Includes fix for build regression on armhf and armel

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
static inline int a_cas(volatile int *p, int t, int s)
27
27
{
28
 
        __asm__("1:     lwarx %0, 0, %1\n"
 
28
        __asm__("\n"
 
29
                "       sync\n"
 
30
                "1:     lwarx %0, 0, %4\n"
29
31
                "       cmpw %0, %2\n"
30
32
                "       bne 1f\n"
31
 
                "       stwcx. %3, 0, %1\n"
 
33
                "       stwcx. %3, 0, %4\n"
32
34
                "       bne- 1b\n"
 
35
                "       isync\n"
33
36
                "1:     \n"
34
 
                : "=&r"(t) : "r"(p), "r"(t), "r"(s) : "cc", "memory" );
 
37
                : "=&r"(t), "+m"(*p) : "r"(t), "r"(s), "r"(p) : "cc", "memory" );
35
38
        return t;
36
39
}
37
40
 
40
43
        return (void *)a_cas(p, (int)t, (int)s);
41
44
}
42
45
 
43
 
static inline long a_cas_l(volatile void *p, long t, long s)
44
 
{
45
 
        return a_cas(p, t, s);
46
 
}
47
 
 
48
 
 
49
46
static inline int a_swap(volatile int *x, int v)
50
47
{
51
48
        int old;
74
71
 
75
72
static inline void a_store(volatile int *p, int x)
76
73
{
77
 
        *p=x;
 
74
        __asm__ __volatile__ ("\n"
 
75
                "       sync\n"
 
76
                "       stw %1, %0\n"
 
77
                "       isync\n"
 
78
                : "=m"(*p) : "r"(x) : "memory" );
78
79
}
79
80
 
80
81
static inline void a_spin()