The Pedigree Project
0.1
|
Public Member Functions | |
Spinlock (bool bLocked, bool bAvoidTracking=false) | |
bool | acquire (bool recurse=false, bool safe=true) |
void | exit () |
void | release () |
bool | acquired () |
bool | interrupts () const |
Static Public Attributes | |
static const bool | allow_recursion = true |
Private Member Functions | |
void | unwind () |
void | trackRelease () const |
Private Attributes | |
volatile bool | m_bInterrupts = false |
Atomic< bool > | m_Atom = true |
Atomic< uint64_t > | m_CpuState = 0 |
uint64_t | m_Sentinel = 0 |
uint32_t | m_Magic = 0xdeadbaba |
uint32_t | m_MagicAlign = 0 |
void * | m_pOwner = nullptr |
size_t | m_Level = 0 |
size_t | m_OwnedProcessor = ~0 |
uintptr_t | m_Ra = 0 |
bool | m_bAvoidTracking = false |
bool | m_bOwned = false |
Friends | |
class | PerProcessorScheduler |
class | LocksCommand |
Definition at line 27 of file Spinlock.h.
bool Spinlock::acquire | ( | bool | recurse = false , |
bool | safe = true |
||
) |
Enter the critical section.
The 'safe' param disables certain deadlock checks that might fail in some circumstances (especially during multiprocessor startup). It really shouldn't be used for the majority of cases.
Definition at line 43 of file Spinlock.cc.
References LocksCommand::checkState(), Processor::getCount(), Processor::getInterrupts(), Hex, Processor::id(), Processor::information(), panic(), Processor::pause(), LocksCommand::setFatal(), Processor::setInterrupts(), and WARNING.
Referenced by PosixSubsystem::acquire(), MemoryMapManager::acquireLock(), Semaphore::acquireWithResult(), PerProcessorScheduler::addThread(), ArmV7VirtualAddressSpace::allocateStack(), MemoryMapManager::contains(), Ohci::doAsync(), Cache::evict(), Log::flushEntry(), GPTimer::initialise(), CdiIrqHandler::irq(), Thread::join(), Process::kill(), PerProcessorScheduler::killCurrentThread(), KernelElf::lockModules(), InputManager::mainThread(), PerProcessorScheduler::processorAddThread(), SlamCache::recovery(), Semaphore::release(), PosixSubsystem::release(), MemoryMapManager::remove(), Semaphore::removeThread(), PerProcessorScheduler::schedule(), Thread::sendEvent(), MemoryMappedFile::setPermissions(), MemoryMapManager::setPermissions(), Thread::shutdown(), ConditionVariable::signal(), Thread::Thread(), MemoryMapManager::trap(), PosixSubsystem::~PosixSubsystem(), and Thread::~Thread().
void Spinlock::exit | ( | ) |
Exit the critical section, without restoring interrupts.
Definition at line 213 of file Spinlock.cc.
References Dec, Processor::getInterrupts(), Hex, panic(), and trackRelease().
Referenced by PerProcessorScheduler::killCurrentThread(), release(), and PerProcessorScheduler::schedule().
void Spinlock::release | ( | ) |
Exit the critical section, restoring previous interrupt state.
Definition at line 273 of file Spinlock.cc.
References exit(), and Processor::setInterrupts().
Referenced by PosixSubsystem::acquire(), Semaphore::acquireWithResult(), PerProcessorScheduler::addThread(), ArmV7VirtualAddressSpace::allocateStack(), MemoryMapManager::contains(), Ohci::doAsync(), Cache::evict(), Log::flushEntry(), Process::getThread(), GPTimer::initialise(), CdiIrqHandler::irq(), Thread::join(), InputManager::mainThread(), SlamCache::recovery(), Semaphore::release(), PosixSubsystem::release(), MemoryMapManager::releaseLock(), MemoryMapManager::remove(), Semaphore::removeThread(), PerProcessorScheduler::schedule(), Thread::sendEvent(), MemoryMappedFile::setPermissions(), MemoryMapManager::setPermissions(), Thread::shutdown(), ConditionVariable::signal(), PerProcessorScheduler::sleep(), MemoryMapManager::trap(), KernelElf::unlockModules(), PosixSubsystem::~PosixSubsystem(), and Thread::~Thread().
|
private |
Track the release of this lock.
Definition at line 194 of file Spinlock.cc.
References Hex, LocksCommand::lockReleased(), and LocksCommand::setFatal().
Referenced by exit().
|
private |
Unwind the spinlock because a thread is releasing it.
Definition at line 286 of file Spinlock.cc.
Referenced by PerProcessorScheduler::addThread(), and PerProcessorScheduler::schedule().
|
private |
Definition at line 67 of file Spinlock.h.