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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

78 lines
1.8 KiB
C++
Raw Normal View History

// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
2020-01-24 19:38:20 +00:00
#pragma once
2023-02-06 18:14:27 +00:00
#include <condition_variable>
2020-01-26 20:14:18 +00:00
#include <cstddef>
#include <memory>
#include <mutex>
2020-01-26 20:14:18 +00:00
#include "core/arm/arm_interface.h"
2020-01-24 19:38:20 +00:00
namespace Kernel {
class KernelCore;
2020-01-24 19:38:20 +00:00
} // namespace Kernel
namespace Core {
2020-01-24 19:38:20 +00:00
class ExclusiveMonitor;
class System;
} // namespace Core
2020-01-24 19:38:20 +00:00
namespace Kernel {
class PhysicalCore {
public:
PhysicalCore(KernelCore& kernel, std::size_t core_index);
2020-01-26 20:14:18 +00:00
~PhysicalCore();
2020-01-24 19:38:20 +00:00
2022-07-08 00:06:46 +00:00
YUZU_NON_COPYABLE(PhysicalCore);
YUZU_NON_MOVEABLE(PhysicalCore);
// Execute guest code running on the given thread.
void RunThread(KThread* thread);
// Copy context from thread to current core.
void LoadContext(const KThread* thread);
void LoadSvcArguments(const KProcess& process, std::span<const uint64_t, 8> args);
// Copy context from current core to thread.
void SaveContext(KThread* thread) const;
void SaveSvcArguments(KProcess& process, std::span<uint64_t, 8> args) const;
// Copy floating point status registers to the target thread.
void CloneFpuStatus(KThread* dst) const;
// Log backtrace of current processor state.
void LogBacktrace();
// Wait for an interrupt.
void Idle();
// Interrupt this core.
void Interrupt();
// Clear this core's interrupt.
void ClearInterrupt();
// Check if this core is interrupted.
2020-06-27 22:20:06 +00:00
bool IsInterrupted() const;
2020-01-24 19:38:20 +00:00
std::size_t CoreIndex() const {
2023-03-07 04:08:53 +00:00
return m_core_index;
2020-01-24 19:38:20 +00:00
}
private:
KernelCore& m_kernel;
2023-03-07 04:08:53 +00:00
const std::size_t m_core_index;
std::mutex m_guard;
std::condition_variable m_on_interrupt;
Core::ArmInterface* m_arm_interface{};
KThread* m_current_thread{};
2023-03-07 04:08:53 +00:00
bool m_is_interrupted{};
bool m_is_single_core{};
};
2020-01-24 19:38:20 +00:00
} // namespace Kernel