mirror of
https://github.com/corda/corda.git
synced 2025-06-22 00:57:21 +00:00
Initial release of Intel SGX for Linux.
This release is used in conjunction with the linux-sgx-driver Intial release: https://github.com/01org/linux-sgx-driver commit-id: 0e865ce5e6b297a787bcdc12d98bada8174be6d7 Intel-id: 33399 Signed-off-by: Angie Chinchilla <angie.v.chinchilla@intel.com>
This commit is contained in:
28
sdk/cpprt/linux/atomic.h
Normal file
28
sdk/cpprt/linux/atomic.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef __has_builtin
|
||||
#define __has_builtin(x) 0
|
||||
#endif
|
||||
#ifndef __has_feature
|
||||
#define __has_feature(x) 0
|
||||
#endif
|
||||
/**
|
||||
* Swap macro that enforces a happens-before relationship with a corresponding
|
||||
* ATOMIC_LOAD.
|
||||
*/
|
||||
#if __has_feature(cxx_atomic)
|
||||
#define ATOMIC_SWAP(addr, val)\
|
||||
__atomic_exchange(addr, val, __ATOMIC_ACQ_REL)
|
||||
#elif __has_builtin(__sync_swap)
|
||||
#define ATOMIC_SWAP(addr, val)\
|
||||
__sync_swap(addr, val)
|
||||
#else
|
||||
#define ATOMIC_SWAP(addr, val)\
|
||||
__sync_lock_test_and_set(addr, val)
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_atomic)
|
||||
#define ATOMIC_LOAD(addr)\
|
||||
__atomic_load(addr, __ATOMIC_ACQUIRE)
|
||||
#else
|
||||
#define ATOMIC_LOAD(addr)\
|
||||
(__sync_synchronize(), *addr)
|
||||
#endif
|
Reference in New Issue
Block a user