Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix spinlock headers #477

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions arch/arm/arm64/include/uk/asm/spinlock.h
Expand Up @@ -34,6 +34,7 @@
#error Do not include this header directly
#endif

#include <uk/essentials.h>
#include <uk/arch/atomic.h>

struct __align(8) __spinlock {
Expand Down
16 changes: 10 additions & 6 deletions include/uk/arch/spinlock.h
Expand Up @@ -29,6 +29,7 @@
extern "C" {
#endif

#include <uk/config.h>
#include <uk/arch/lcpu.h>

#ifdef CONFIG_HAVE_SMP
Expand All @@ -40,36 +41,39 @@ typedef struct __spinlock __spinlock;
/**
* UKARCH_SPINLOCK_INITIALIZER() macro
*
* Statically initialize a spinlock to unlocked stated.
* Statically initialize a spinlock to unlocked state.
*/
#ifndef UKARCH_SPINLOCK_INITIALIZER
#error The spinlock implementation must define UKARCH_SPINLOCK_INITIALIZER
#endif /* UKARCH_SPINLOCK_INITIALIZER */

/**
* Initialize a spinlock to unlocked state.
*
* @param [in/out] lock Pointer to spinlock.
* @param [in,out] lock Pointer to spinlock.
*/
void ukarch_spin_init(__spinlock *lock);

/**
* Acquire spinlock. It is guaranteed that the spinlock will be held
* exclusively.
*
* @param [in/out] lock Pointer to spinlock.
* @param [in,out] lock Pointer to spinlock.
*/
void ukarch_spin_lock(__spinlock *lock);

/**
* Release previously acquired spinlock.
*
* @param [in/out] lock Pointer to spinlock.
* @param [in,out] lock Pointer to spinlock.
*/
void ukarch_spin_unlock(__spinlock *lock);

/**
* Try to acquire spinlock. If the lock is already acquired (busy), this
* function returns instead of spinning.
*
* @param [in/out] lock Pointer to spinlock.
* @param [in,out] lock Pointer to spinlock.
*
* @return A non-zero value if spinlock was acquired, 0 otherwise.
*/
Expand All @@ -78,7 +82,7 @@ int ukarch_spin_trylock(__spinlock *lock);
/**
* Read spinlock state. No lock/unlock operations are performed on the lock.
*
* @param [in/out] lock Pointer to spinlock.
* @param [in,out] lock Pointer to spinlock.
*
* @return A non-zero value if spinlock is acquired, 0 otherwise.
*/
Expand Down