summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/physical_core.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-11-13 20:11:12 +0100
committerbunnei <bunneidev@gmail.com>2020-11-29 10:31:51 +0100
commit7b642c77811dc3887756f5abac5a9710564b098e (patch)
tree09c9d764734db56896f77d986afa6ccd5d2c745d /src/core/hle/kernel/physical_core.cpp
parentMerge pull request #4998 from Morph1984/bioshock-patch (diff)
downloadyuzu-7b642c77811dc3887756f5abac5a9710564b098e.tar
yuzu-7b642c77811dc3887756f5abac5a9710564b098e.tar.gz
yuzu-7b642c77811dc3887756f5abac5a9710564b098e.tar.bz2
yuzu-7b642c77811dc3887756f5abac5a9710564b098e.tar.lz
yuzu-7b642c77811dc3887756f5abac5a9710564b098e.tar.xz
yuzu-7b642c77811dc3887756f5abac5a9710564b098e.tar.zst
yuzu-7b642c77811dc3887756f5abac5a9710564b098e.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/physical_core.cpp38
1 files changed, 30 insertions, 8 deletions
diff --git a/src/core/hle/kernel/physical_core.cpp b/src/core/hle/kernel/physical_core.cpp
index 6e04d025f..50aca5752 100644
--- a/src/core/hle/kernel/physical_core.cpp
+++ b/src/core/hle/kernel/physical_core.cpp
@@ -4,21 +4,43 @@
#include "common/spin_lock.h"
#include "core/arm/cpu_interrupt_handler.h"
+#include "core/arm/dynarmic/arm_dynarmic_32.h"
+#include "core/arm/dynarmic/arm_dynarmic_64.h"
#include "core/core.h"
+#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/physical_core.h"
#include "core/hle/kernel/scheduler.h"
namespace Kernel {
-PhysicalCore::PhysicalCore(Core::System& system, std::size_t id, Kernel::Scheduler& scheduler,
- Core::CPUInterruptHandler& interrupt_handler)
- : interrupt_handler{interrupt_handler},
- core_index{id}, scheduler{scheduler}, guard{std::make_unique<Common::SpinLock>()} {}
+PhysicalCore::PhysicalCore(std::size_t core_index, Core::System& system,
+ Kernel::Scheduler& scheduler, Core::CPUInterrupts& interrupts)
+ : core_index{core_index}, system{system}, scheduler{scheduler},
+ interrupts{interrupts}, guard{std::make_unique<Common::SpinLock>()} {}
PhysicalCore::~PhysicalCore() = default;
+void PhysicalCore::Initialize([[maybe_unused]] bool is_64_bit) {
+#ifdef ARCHITECTURE_x86_64
+ auto& kernel = system.Kernel();
+ if (is_64_bit) {
+ arm_interface = std::make_unique<Core::ARM_Dynarmic_64>(
+ system, interrupts, kernel.IsMulticore(), kernel.GetExclusiveMonitor(), core_index);
+ } else {
+ arm_interface = std::make_unique<Core::ARM_Dynarmic_32>(
+ system, interrupts, kernel.IsMulticore(), kernel.GetExclusiveMonitor(), core_index);
+ }
+#else
+#error Platform not supported yet.
+#endif
+}
+
+void PhysicalCore::Run() {
+ arm_interface->Run();
+}
+
void PhysicalCore::Idle() {
- interrupt_handler.AwaitInterrupt();
+ interrupts[core_index].AwaitInterrupt();
}
void PhysicalCore::Shutdown() {
@@ -26,18 +48,18 @@ void PhysicalCore::Shutdown() {
}
bool PhysicalCore::IsInterrupted() const {
- return interrupt_handler.IsInterrupted();
+ return interrupts[core_index].IsInterrupted();
}
void PhysicalCore::Interrupt() {
guard->lock();
- interrupt_handler.SetInterrupt(true);
+ interrupts[core_index].SetInterrupt(true);
guard->unlock();
}
void PhysicalCore::ClearInterrupt() {
guard->lock();
- interrupt_handler.SetInterrupt(false);
+ interrupts[core_index].SetInterrupt(false);
guard->unlock();
}