PageRenderTime 10ms CodeModel.GetById 8ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc/x86.h.rej

http://github.com/feyeleanor/RubyGoLightly
Unknown | 40 lines | 38 code | 2 blank | 0 comment | 0 complexity | 208ee0faf2bf54d64ec33e032e709e67 MD5 | raw file
 1***************
 2*** 141,150 ****
 3  			               AO_t new_val1, AO_t new_val2) 
 4  {
 5    char result;
 6-   __asm__ __volatile__("lock; cmpxchg8b %0; setz %1"
 7  	    	       : "=m"(*addr), "=q"(result)
 8- 		       : "m"(*addr), "d" (old_val1), "a" (old_val2),
 9- 		         "c" (new_val1), "b" (new_val2) : "memory");
10    return (int) result;
11  }
12  
13--- 141,167 ----
14  			               AO_t new_val1, AO_t new_val2) 
15  {
16    char result;
17+   #if __PIC__
18+   /* If PIC is turned on, we can't use %ebx as it is reserved for the
19+      GOT poiner.  We can save and restore %ebx because GCC won't be
20+      using it for anything else (such as any of the m operands) */
21+   __asm__ __volatile__("pushl %%ebx;"   /* save ebx used for PIC GOT ptr */
22+ 		       "movl %6,%%ebx;" /* move new_val2 to %ebx */
23+ 		       "lock; cmpxchg8b %0; setz %1;"
24+ 		       "pop %%ebx;"     /* restore %ebx */
25  	    	       : "=m"(*addr), "=q"(result)
26+ 		       : "m"(*addr), "d" (old_val2), "a" (old_val1),
27+ 		         "c" (new_val2), "m" (new_val1) : "memory");
28+   #else
29+   /* We can't just do the same thing in non-PIC mode, because GCC
30+    * might be using %ebx as the memory operand.  We could have ifdef'd
31+    * in a clobber, but there's no point doing the push/pop if we don't
32+    * have to. */
33+   __asm__ __volatile__("lock; cmpxchg8b %0; setz %1;"
34+ 	    	       : "=m"(*addr), "=q"(result)
35+ 		       : "m"(*addr), "d" (old_val2), "a" (old_val1),
36+ 		         "c" (new_val2), "b" (new_val1) : "memory");
37+   #endif
38    return (int) result;
39  }
40