| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 // This file is an internal atomic implementation, use base/atomicops.h instead. | 5 // This file is an internal atomic implementation, use base/atomicops.h instead. | 
| 6 | 6 | 
| 7 #ifndef BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ | 7 #ifndef BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ | 
| 8 #define BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ | 8 #define BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ | 
| 9 | 9 | 
| 10 #include "base/base_export.h" |  | 
| 11 |  | 
| 12 // This struct is not part of the public API of this module; clients may not |  | 
| 13 // use it.  (However, it's exported via BASE_EXPORT because clients implicitly |  | 
| 14 // do use it at link time by inlining these functions.) |  | 
| 15 // Features of this x86.  Values may not be correct before main() is run, |  | 
| 16 // but are set conservatively. |  | 
| 17 struct AtomicOps_x86CPUFeatureStruct { |  | 
| 18   bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence |  | 
| 19                             // after acquire compare-and-swap. |  | 
| 20 }; |  | 
| 21 BASE_EXPORT extern struct AtomicOps_x86CPUFeatureStruct |  | 
| 22     AtomicOps_Internalx86CPUFeatures; |  | 
| 23 |  | 
| 24 #define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") | 10 #define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") | 
| 25 | 11 | 
| 26 namespace base { | 12 namespace base { | 
| 27 namespace subtle { | 13 namespace subtle { | 
| 28 | 14 | 
| 29 // 32-bit low-level operations on any platform. | 15 // 32-bit low-level operations on any platform. | 
| 30 | 16 | 
| 31 inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, | 17 inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, | 
| 32                                          Atomic32 old_value, | 18                                          Atomic32 old_value, | 
| 33                                          Atomic32 new_value) { | 19                                          Atomic32 new_value) { | 
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 233 } | 219 } | 
| 234 | 220 | 
| 235 #endif  // defined(__x86_64__) | 221 #endif  // defined(__x86_64__) | 
| 236 | 222 | 
| 237 } // namespace base::subtle | 223 } // namespace base::subtle | 
| 238 } // namespace base | 224 } // namespace base | 
| 239 | 225 | 
| 240 #undef ATOMICOPS_COMPILER_BARRIER | 226 #undef ATOMICOPS_COMPILER_BARRIER | 
| 241 | 227 | 
| 242 #endif  // BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ | 228 #endif  // BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ | 
| OLD | NEW | 
|---|