OLD | NEW |
1 // Copyright (c) 2011, Google Inc. | 1 // Copyright (c) 2011, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 22 matching lines...) Expand all Loading... |
33 // | 33 // |
34 // This file is an internal atomic implementation, use base/atomicops.h instead. | 34 // This file is an internal atomic implementation, use base/atomicops.h instead. |
35 // | 35 // |
36 // This code implements ARM atomics for architectures V6 and newer. | 36 // This code implements ARM atomics for architectures V6 and newer. |
37 | 37 |
38 #ifndef BASE_ATOMICOPS_INTERNALS_ARM_V6PLUS_H_ | 38 #ifndef BASE_ATOMICOPS_INTERNALS_ARM_V6PLUS_H_ |
39 #define BASE_ATOMICOPS_INTERNALS_ARM_V6PLUS_H_ | 39 #define BASE_ATOMICOPS_INTERNALS_ARM_V6PLUS_H_ |
40 | 40 |
41 #include <stdio.h> | 41 #include <stdio.h> |
42 #include <stdlib.h> | 42 #include <stdlib.h> |
| 43 #include "base/abort.h" |
43 #include "base/basictypes.h" // For COMPILE_ASSERT | 44 #include "base/basictypes.h" // For COMPILE_ASSERT |
44 | 45 |
45 // The LDREXD and STREXD instructions in ARM all v7 variants or above. In v6, | 46 // The LDREXD and STREXD instructions in ARM all v7 variants or above. In v6, |
46 // only some variants support it. For simplicity, we only use exclusive | 47 // only some variants support it. For simplicity, we only use exclusive |
47 // 64-bit load/store in V7 or above. | 48 // 64-bit load/store in V7 or above. |
48 #if defined(ARMV7) | 49 #if defined(ARMV7) |
49 # define BASE_ATOMICOPS_HAS_LDREXD_AND_STREXD | 50 # define BASE_ATOMICOPS_HAS_LDREXD_AND_STREXD |
50 #endif | 51 #endif |
51 | 52 |
52 typedef int32_t Atomic32; | 53 typedef int32_t Atomic32; |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 : "=r" (res) | 281 : "=r" (res) |
281 : "r"(ptr), "Q"(*ptr)); | 282 : "r"(ptr), "Q"(*ptr)); |
282 return res; | 283 return res; |
283 } | 284 } |
284 | 285 |
285 #else // BASE_ATOMICOPS_HAS_LDREXD_AND_STREXD | 286 #else // BASE_ATOMICOPS_HAS_LDREXD_AND_STREXD |
286 | 287 |
287 inline void NotImplementedFatalError(const char *function_name) { | 288 inline void NotImplementedFatalError(const char *function_name) { |
288 fprintf(stderr, "64-bit %s() not implemented on this platform\n", | 289 fprintf(stderr, "64-bit %s() not implemented on this platform\n", |
289 function_name); | 290 function_name); |
290 abort(); | 291 tcmalloc::Abort(); |
291 } | 292 } |
292 | 293 |
293 inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, | 294 inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, |
294 Atomic64 old_value, | 295 Atomic64 old_value, |
295 Atomic64 new_value) { | 296 Atomic64 new_value) { |
296 NotImplementedFatalError("NoBarrier_CompareAndSwap"); | 297 NotImplementedFatalError("NoBarrier_CompareAndSwap"); |
297 return 0; | 298 return 0; |
298 } | 299 } |
299 | 300 |
300 inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, | 301 inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 Atomic64 old_value, | 360 Atomic64 old_value, |
360 Atomic64 new_value) { | 361 Atomic64 new_value) { |
361 MemoryBarrier(); | 362 MemoryBarrier(); |
362 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); | 363 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); |
363 } | 364 } |
364 | 365 |
365 } // namespace subtle ends | 366 } // namespace subtle ends |
366 } // namespace base ends | 367 } // namespace base ends |
367 | 368 |
368 #endif // BASE_ATOMICOPS_INTERNALS_ARM_V6PLUS_H_ | 369 #endif // BASE_ATOMICOPS_INTERNALS_ARM_V6PLUS_H_ |
OLD | NEW |