forked from etc/pineapple-src
early-access version 2203
This commit is contained in:
parent
89013ee4f7
commit
0386e477a0
3 changed files with 7 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 2202.
|
This is the source code for early-access 2203.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,7 @@ u64 NativeClock::GetRTSC() {
|
||||||
TimePoint new_time_point{};
|
TimePoint new_time_point{};
|
||||||
TimePoint current_time_point{};
|
TimePoint current_time_point{};
|
||||||
do {
|
do {
|
||||||
std::ignore = Common::AtomicCompareAndSwap(current_time_point.pack.data(), time_point.pack,
|
current_time_point.pack = time_point.pack;
|
||||||
u128{0}); // comparison value doesn't matter
|
|
||||||
_mm_mfence();
|
_mm_mfence();
|
||||||
const u64 current_measure = __rdtsc();
|
const u64 current_measure = __rdtsc();
|
||||||
u64 diff = current_measure - current_time_point.inner.last_measure;
|
u64 diff = current_measure - current_time_point.inner.last_measure;
|
||||||
|
@ -79,9 +78,7 @@ void NativeClock::Pause(bool is_paused) {
|
||||||
TimePoint current_time_point{};
|
TimePoint current_time_point{};
|
||||||
TimePoint new_time_point{};
|
TimePoint new_time_point{};
|
||||||
do {
|
do {
|
||||||
std::ignore =
|
current_time_point.pack = time_point.pack;
|
||||||
Common::AtomicCompareAndSwap(current_time_point.pack.data(), time_point.pack,
|
|
||||||
u128{0}); // comparison value doesn't matter
|
|
||||||
new_time_point.pack = current_time_point.pack;
|
new_time_point.pack = current_time_point.pack;
|
||||||
_mm_mfence();
|
_mm_mfence();
|
||||||
new_time_point.inner.last_measure = __rdtsc();
|
new_time_point.inner.last_measure = __rdtsc();
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <atomic>
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "core/hle/kernel/k_spin_lock.h"
|
#include "core/hle/kernel/k_spin_lock.h"
|
||||||
#include "core/hle/kernel/k_thread.h"
|
#include "core/hle/kernel/k_thread.h"
|
||||||
|
@ -20,7 +19,7 @@ public:
|
||||||
explicit KAbstractSchedulerLock(KernelCore& kernel_) : kernel{kernel_} {}
|
explicit KAbstractSchedulerLock(KernelCore& kernel_) : kernel{kernel_} {}
|
||||||
|
|
||||||
bool IsLockedByCurrentThread() const {
|
bool IsLockedByCurrentThread() const {
|
||||||
return owner_thread.load(std::memory_order::consume) == GetCurrentThreadPointer(kernel);
|
return owner_thread == GetCurrentThreadPointer(kernel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lock() {
|
void Lock() {
|
||||||
|
@ -39,7 +38,7 @@ public:
|
||||||
|
|
||||||
// Increment count, take ownership.
|
// Increment count, take ownership.
|
||||||
lock_count = 1;
|
lock_count = 1;
|
||||||
owner_thread.store(GetCurrentThreadPointer(kernel), std::memory_order::release);
|
owner_thread = GetCurrentThreadPointer(kernel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +53,7 @@ public:
|
||||||
SchedulerType::UpdateHighestPriorityThreads(kernel);
|
SchedulerType::UpdateHighestPriorityThreads(kernel);
|
||||||
|
|
||||||
// Note that we no longer hold the lock, and unlock the spinlock.
|
// Note that we no longer hold the lock, and unlock the spinlock.
|
||||||
owner_thread.store(nullptr, std::memory_order::release);
|
owner_thread = nullptr;
|
||||||
spin_lock.Unlock();
|
spin_lock.Unlock();
|
||||||
|
|
||||||
// Enable scheduling, and perform a rescheduling operation.
|
// Enable scheduling, and perform a rescheduling operation.
|
||||||
|
@ -66,7 +65,7 @@ private:
|
||||||
KernelCore& kernel;
|
KernelCore& kernel;
|
||||||
KAlignedSpinLock spin_lock{};
|
KAlignedSpinLock spin_lock{};
|
||||||
s32 lock_count{};
|
s32 lock_count{};
|
||||||
std::atomic<KThread*> owner_thread{};
|
KThread* owner_thread{};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
Loading…
Reference in a new issue