comments
This commit is contained in:
@@ -9,6 +9,13 @@
|
||||
#include "kernel.h"
|
||||
#include "spinlock.h"
|
||||
|
||||
/*
|
||||
* spinlock_acquire - Lock a lock
|
||||
* @lock: pointer to desired spinlock
|
||||
*
|
||||
* Saves the RFLAGS register, then acquires a lock.
|
||||
* Pause instruction is used to ease the CPU.
|
||||
*/
|
||||
void spinlock_acquire(struct spinlock_t* lock)
|
||||
{
|
||||
uint64_t rflags;
|
||||
@@ -21,6 +28,14 @@ void spinlock_acquire(struct spinlock_t* lock)
|
||||
lock->rflags = rflags;
|
||||
}
|
||||
|
||||
/*
|
||||
* spinlock_release - Unlock a lock
|
||||
* @lock: pointer to desired spinlock
|
||||
*
|
||||
* Gets saved RFLAGS register from the lock and
|
||||
* unlocks it (clears locked state).
|
||||
* RFLAGS is then restored.
|
||||
*/
|
||||
void spinlock_release(struct spinlock_t* lock)
|
||||
{
|
||||
uint64_t rflags = lock->rflags;
|
||||
|
||||
Reference in New Issue
Block a user