coreinit: Add 32 bit atomic exports.

This commit is contained in:
James Benton 2017-04-10 23:17:19 +01:00
parent 604b18faf0
commit 840d91c62e
2 changed files with 70 additions and 0 deletions

59
include/coreinit/atomic.h Normal file
View File

@ -0,0 +1,59 @@
#pragma once
#include <wut.h>
/**
* \defgroup coreinit_atomic Atomic Operations
* \ingroup coreinit
*
* These functions are used for atomically operating on 32 bit values in memory.
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
BOOL
OSCompareAndSwapAtomic(volatile uint32_t *ptr,
uint32_t compare,
uint32_t value);
BOOL
OSCompareAndSwapAtomicEx(volatile uint32_t *ptr,
uint32_t compare,
uint32_t value,
uint32_t *old);
uint32_t
OSSwapAtomic(volatile uint32_t *ptr,
uint32_t value);
int32_t
OSAddAtomic(volatile int32_t *ptr,
int32_t value);
uint32_t
OSAndAtomic(volatile uint32_t *ptr,
uint32_t value);
uint32_t
OSOrAtomic(volatile uint32_t *ptr,
uint32_t value);
uint32_t
OSXorAtomic(volatile uint32_t *ptr,
uint32_t value);
BOOL
OSTestAndClearAtomic(volatile uint32_t *ptr,
uint32_t bit);
BOOL
OSTestAndSetAtomic(volatile uint32_t *ptr,
uint32_t bit);
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -12,6 +12,17 @@ EXPORT(OSSetAlarmTag);
EXPORT(OSSetAlarmUserData);
EXPORT(OSWaitAlarm);
// coreinit/atomic.h
EXPORT(OSCompareAndSwapAtomic);
EXPORT(OSCompareAndSwapAtomicEx);
EXPORT(OSSwapAtomic);
EXPORT(OSAddAtomic);
EXPORT(OSAndAtomic);
EXPORT(OSOrAtomic);
EXPORT(OSXorAtomic);
EXPORT(OSTestAndClearAtomic);
EXPORT(OSTestAndSetAtomic);
// coreinit/atomic64.h
EXPORT(OSGetAtomic64);
EXPORT(OSSetAtomic64);