2019-02-26 02:02:50 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2014, Paweł Dziepak, pdziepak@quarnos.org.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* François Revol <revol@free.fr>
|
|
|
|
*/
|
|
|
|
#ifndef _KERNEL_ARCH_RISCV64_ATOMIC_H
|
|
|
|
#define _KERNEL_ARCH_RISCV64_ATOMIC_H
|
|
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
memory_read_barrier_inline(void)
|
|
|
|
{
|
2021-06-06 16:51:53 +03:00
|
|
|
// TODO: investigate reparate read/write barriers
|
|
|
|
__sync_synchronize();
|
2019-02-26 02:02:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
memory_write_barrier_inline(void)
|
|
|
|
{
|
2021-06-06 16:51:53 +03:00
|
|
|
// TODO: investigate reparate read/write barriers
|
|
|
|
__sync_synchronize();
|
2019-02-26 02:02:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
memory_full_barrier_inline(void)
|
|
|
|
{
|
2021-06-06 16:51:53 +03:00
|
|
|
__sync_synchronize();
|
2019-02-26 02:02:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define memory_read_barrier memory_read_barrier_inline
|
|
|
|
#define memory_write_barrier memory_write_barrier_inline
|
|
|
|
#define memory_full_barrier memory_full_barrier_inline
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _KERNEL_ARCH_RISCV64_ATOMIC_H
|