yuzu/src/core/hle/kernel/physical_core.cpp

53 lines
1.4 KiB
C++
Raw Normal View History

2020-01-24 20:38:20 +01:00
// Copyright 2020 yuzu Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/logging/log.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/unicorn/arm_unicorn.h"
#include "core/core.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/physical_core.h"
#include "core/hle/kernel/scheduler.h"
#include "core/hle/kernel/thread.h"
2020-01-24 20:38:20 +01:00
namespace Kernel {
2020-01-26 21:14:18 +01:00
PhysicalCore::PhysicalCore(Core::System& system, KernelCore& kernel, std::size_t id,
Core::ExclusiveMonitor& exclusive_monitor)
2020-01-24 20:38:20 +01:00
: core_index{id}, kernel{kernel} {
#ifdef ARCHITECTURE_x86_64
2020-01-26 21:14:18 +01:00
arm_interface = std::make_shared<Core::ARM_Dynarmic>(system, exclusive_monitor, core_index);
2020-01-24 20:38:20 +01:00
#else
2020-01-26 21:14:18 +01:00
arm_interface = std::make_shared<Core::ARM_Unicorn>(system);
2020-01-24 20:38:20 +01:00
LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
#endif
2020-01-26 21:14:18 +01:00
scheduler = std::make_shared<Kernel::Scheduler>(system, *arm_interface, core_index);
2020-01-24 20:38:20 +01:00
}
2020-01-26 21:14:18 +01:00
PhysicalCore::~PhysicalCore() = default;
void PhysicalCore::Run() {
arm_interface->Run();
arm_interface->ClearExclusiveState();
}
void PhysicalCore::Step() {
arm_interface->Step();
}
void PhysicalCore::Stop() {
arm_interface->PrepareReschedule();
}
void PhysicalCore::Shutdown() {
scheduler->Shutdown();
}
2020-01-24 20:38:20 +01:00
} // namespace Kernel