mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-22 02:12:06 +00:00
thermosphere: uninline recursive lock funcs
This commit is contained in:
parent
217c1ad054
commit
c64ccd86ee
5 changed files with 42 additions and 22 deletions
|
@ -18,7 +18,7 @@
|
|||
#include "breakpoints.h"
|
||||
#include "breakpoints_watchpoints_load.h"
|
||||
#include "utils.h"
|
||||
#include "sysreg.h"
|
||||
#include "core_ctx.h"
|
||||
|
||||
BreakpointManager g_breakpointManager = {0};
|
||||
|
||||
|
|
37
thermosphere/src/spinlock.c
Normal file
37
thermosphere/src/spinlock.c
Normal file
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Atmosphère-NX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "spinlock.h"
|
||||
#include "core_ctx.h"
|
||||
|
||||
void recursiveSpinlockLock(RecursiveSpinlock *lock)
|
||||
{
|
||||
if (lock->tag != currentCoreCtx->coreId + 1) {
|
||||
spinlockLock(&lock->lock);
|
||||
lock->tag = currentCoreCtx->coreId + 1;
|
||||
lock->count = 1;
|
||||
} else {
|
||||
++lock->count;
|
||||
}
|
||||
}
|
||||
|
||||
void recursiveSpinlockUnlock(RecursiveSpinlock *lock)
|
||||
{
|
||||
if (--lock->count == 0) {
|
||||
lock->tag = 0;
|
||||
spinlockUnlock(&lock->lock);
|
||||
}
|
||||
}
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core_ctx.h"
|
||||
#include "utils.h"
|
||||
#include "sysreg.h"
|
||||
|
||||
|
@ -51,6 +50,8 @@ static inline void restoreInterruptFlags(u64 flags)
|
|||
|
||||
void spinlockLock(Spinlock *lock);
|
||||
void spinlockUnlock(Spinlock *lock);
|
||||
void recursiveSpinlockLock(RecursiveSpinlock *lock);
|
||||
void recursiveSpinlockUnlock(RecursiveSpinlock *lock);
|
||||
|
||||
static inline u64 spinlockLockMaskIrq(Spinlock *lock)
|
||||
{
|
||||
|
@ -65,25 +66,6 @@ static inline void spinlockUnlockRestoreIrq(Spinlock *lock, u64 flags)
|
|||
restoreInterruptFlags(flags);
|
||||
}
|
||||
|
||||
static inline void recursiveSpinlockLock(RecursiveSpinlock *lock)
|
||||
{
|
||||
if (lock->tag != currentCoreCtx->coreId + 1) {
|
||||
spinlockLock(&lock->lock);
|
||||
lock->tag = currentCoreCtx->coreId + 1;
|
||||
lock->count = 1;
|
||||
} else {
|
||||
++lock->count;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void recursiveSpinlockUnlock(RecursiveSpinlock *lock)
|
||||
{
|
||||
if (--lock->count == 0) {
|
||||
lock->tag = 0;
|
||||
spinlockUnlock(&lock->lock);
|
||||
}
|
||||
}
|
||||
|
||||
static inline u64 recursiveSpinlockLockMaskIrq(RecursiveSpinlock *lock)
|
||||
{
|
||||
u64 ret = maskIrq();
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
#include "watchpoints.h"
|
||||
#include "breakpoints_watchpoints_load.h"
|
||||
#include "utils.h"
|
||||
#include "sysreg.h"
|
||||
#include "core_ctx.h"
|
||||
#include "execute_function.h"
|
||||
#include "debug_log.h"
|
||||
|
||||
WatchpointManager g_watchpointManager = {0};
|
||||
|
|
Loading…
Reference in a new issue