H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 1 | #ifndef _ASM_X86_CMPXCHG_64_H |
2 | #define _ASM_X86_CMPXCHG_64_H | ||||
Jeff Dike | a436ed9 | 2007-05-08 00:35:02 -0700 | [diff] [blame] | 3 | |
Jeremy Fitzhardinge | 00a4154 | 2011-08-18 11:40:22 -0700 | [diff] [blame] | 4 | static inline void set_64bit(volatile u64 *ptr, u64 val) |
5 | { | ||||
6 | *ptr = val; | ||||
7 | } | ||||
8 | |||||
Mathieu Desnoyers | 32f49eab | 2008-02-07 00:16:10 -0800 | [diff] [blame] | 9 | #define cmpxchg64(ptr, o, n) \ |
Joe Perches | e52da35 | 2008-03-23 01:01:52 -0700 | [diff] [blame] | 10 | ({ \ |
Mathieu Desnoyers | 32f49eab | 2008-02-07 00:16:10 -0800 | [diff] [blame] | 11 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ |
12 | cmpxchg((ptr), (o), (n)); \ | ||||
Joe Perches | e52da35 | 2008-03-23 01:01:52 -0700 | [diff] [blame] | 13 | }) |
Peter Zijlstra | f3834b9 | 2009-10-09 10:12:46 +0200 | [diff] [blame] | 14 | |
Mathieu Desnoyers | 32f49eab | 2008-02-07 00:16:10 -0800 | [diff] [blame] | 15 | #define cmpxchg64_local(ptr, o, n) \ |
Joe Perches | e52da35 | 2008-03-23 01:01:52 -0700 | [diff] [blame] | 16 | ({ \ |
Mathieu Desnoyers | 32f49eab | 2008-02-07 00:16:10 -0800 | [diff] [blame] | 17 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ |
18 | cmpxchg_local((ptr), (o), (n)); \ | ||||
Joe Perches | e52da35 | 2008-03-23 01:01:52 -0700 | [diff] [blame] | 19 | }) |
Jeff Dike | a436ed9 | 2007-05-08 00:35:02 -0700 | [diff] [blame] | 20 | |
Borislav Petkov | 362f924 | 2015-12-07 10:39:41 +0100 | [diff] [blame^] | 21 | #define system_has_cmpxchg_double() boot_cpu_has(X86_FEATURE_CX16) |
Christoph Lameter | 3824abd | 2011-06-01 12:25:47 -0500 | [diff] [blame] | 22 | |
H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 23 | #endif /* _ASM_X86_CMPXCHG_64_H */ |