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

45 lines
1.1 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/spin_lock.h"
#include "core/arm/cpu_interrupt_handler.h"
#include "core/core.h"
#include "core/hle/kernel/physical_core.h"
#include "core/hle/kernel/scheduler.h"
2020-01-24 20:38:20 +01:00
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>()} {}
2020-01-24 20:38:20 +01:00
2020-01-26 21:14:18 +01:00
PhysicalCore::~PhysicalCore() = default;
void PhysicalCore::Idle() {
interrupt_handler.AwaitInterrupt();
}
void PhysicalCore::Shutdown() {
scheduler.Shutdown();
}
2020-06-28 00:20:06 +02:00
bool PhysicalCore::IsInterrupted() const {
return interrupt_handler.IsInterrupted();
}
void PhysicalCore::Interrupt() {
guard->lock();
interrupt_handler.SetInterrupt(true);
guard->unlock();
}
void PhysicalCore::ClearInterrupt() {
guard->lock();
interrupt_handler.SetInterrupt(false);
guard->unlock();
}
2020-01-24 20:38:20 +01:00
} // namespace Kernel