mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-30 02:32:46 +01:00
ArmInterface: Delegate Exclusive monitor factory to exclusive monitor interfasce.
This commit is contained in:
parent
4d6a86b03f
commit
450341b397
3 changed files with 24 additions and 16 deletions
|
@ -2,10 +2,23 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#ifdef ARCHITECTURE_x86_64
|
||||||
|
#include "core/arm/dynarmic/arm_dynarmic.h"
|
||||||
|
#endif
|
||||||
#include "core/arm/exclusive_monitor.h"
|
#include "core/arm/exclusive_monitor.h"
|
||||||
|
#include "core/memory.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
ExclusiveMonitor::~ExclusiveMonitor() = default;
|
ExclusiveMonitor::~ExclusiveMonitor() = default;
|
||||||
|
|
||||||
|
std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor(Memory::Memory& memory, std::size_t num_cores) {
|
||||||
|
#ifdef ARCHITECTURE_x86_64
|
||||||
|
return std::make_unique<Core::DynarmicExclusiveMonitor>(memory, num_cores);
|
||||||
|
#else
|
||||||
|
// TODO(merry): Passthrough exclusive monitor
|
||||||
|
return nullptr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
// Copyright 2018 yuzu emulator team
|
// Copyright 2020 yuzu emulator team
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
|
namespace Memory {
|
||||||
|
class Memory;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
class ExclusiveMonitor {
|
class ExclusiveMonitor {
|
||||||
|
@ -22,4 +28,6 @@ public:
|
||||||
virtual bool ExclusiveWrite128(std::size_t core_index, VAddr vaddr, u128 value) = 0;
|
virtual bool ExclusiveWrite128(std::size_t core_index, VAddr vaddr, u128 value) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor(Memory::Memory& memory, std::size_t num_cores);
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
@ -10,9 +11,6 @@
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/arm/arm_interface.h"
|
#include "core/arm/arm_interface.h"
|
||||||
#ifdef ARCHITECTURE_x86_64
|
|
||||||
#include "core/arm/dynarmic/arm_dynarmic.h"
|
|
||||||
#endif
|
|
||||||
#include "core/arm/exclusive_monitor.h"
|
#include "core/arm/exclusive_monitor.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/core_timing.h"
|
#include "core/core_timing.h"
|
||||||
|
@ -137,7 +135,7 @@ struct KernelCore::Impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializePhysicalCores(KernelCore& kernel) {
|
void InitializePhysicalCores(KernelCore& kernel) {
|
||||||
exclusive_monitor = MakeExclusiveMonitor();
|
exclusive_monitor = Core::MakeExclusiveMonitor(system.Memory(), global_scheduler.CpuCoresCount());
|
||||||
for (std::size_t i = 0; i < global_scheduler.CpuCoresCount(); i++) {
|
for (std::size_t i = 0; i < global_scheduler.CpuCoresCount(); i++) {
|
||||||
cores.emplace_back(system, kernel, i, *exclusive_monitor);
|
cores.emplace_back(system, kernel, i, *exclusive_monitor);
|
||||||
}
|
}
|
||||||
|
@ -156,7 +154,6 @@ struct KernelCore::Impl {
|
||||||
ASSERT(system_resource_limit->SetLimitValue(ResourceType::Sessions, 900).IsSuccess());
|
ASSERT(system_resource_limit->SetLimitValue(ResourceType::Sessions, 900).IsSuccess());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InitializeThreads() {
|
void InitializeThreads() {
|
||||||
thread_wakeup_event_type =
|
thread_wakeup_event_type =
|
||||||
Core::Timing::CreateEvent("ThreadWakeupCallback", ThreadWakeupCallback);
|
Core::Timing::CreateEvent("ThreadWakeupCallback", ThreadWakeupCallback);
|
||||||
|
@ -184,16 +181,6 @@ struct KernelCore::Impl {
|
||||||
system.Memory().SetCurrentPageTable(*process);
|
system.Memory().SetCurrentPageTable(*process);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Core::ExclusiveMonitor> MakeExclusiveMonitor() {
|
|
||||||
#ifdef ARCHITECTURE_x86_64
|
|
||||||
return std::make_unique<Core::DynarmicExclusiveMonitor>(system.Memory(),
|
|
||||||
global_scheduler.CpuCoresCount());
|
|
||||||
#else
|
|
||||||
// TODO(merry): Passthrough exclusive monitor
|
|
||||||
return nullptr;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
std::atomic<u32> next_object_id{0};
|
std::atomic<u32> next_object_id{0};
|
||||||
std::atomic<u64> next_kernel_process_id{Process::InitialKIPIDMin};
|
std::atomic<u64> next_kernel_process_id{Process::InitialKIPIDMin};
|
||||||
std::atomic<u64> next_user_process_id{Process::ProcessIDMin};
|
std::atomic<u64> next_user_process_id{Process::ProcessIDMin};
|
||||||
|
|
Loading…
Reference in a new issue