2022-04-23 08:59:50 +00:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2016-09-02 03:07:14 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-04-10 14:46:29 +00:00
|
|
|
#include <atomic>
|
2018-01-09 21:33:46 +00:00
|
|
|
#include <memory>
|
2020-02-26 19:53:47 +00:00
|
|
|
#include <unordered_map>
|
|
|
|
|
2021-05-26 19:09:53 +00:00
|
|
|
#include <dynarmic/interface/A64/a64.h>
|
2016-09-02 03:07:14 +00:00
|
|
|
#include "common/common_types.h"
|
2020-02-26 19:53:47 +00:00
|
|
|
#include "common/hash.h"
|
2016-09-02 03:07:14 +00:00
|
|
|
#include "core/arm/arm_interface.h"
|
2023-07-21 23:27:18 +00:00
|
|
|
#include "core/arm/dynarmic/dynarmic_exclusive_monitor.h"
|
2018-01-09 21:33:46 +00:00
|
|
|
|
2020-03-31 19:10:44 +00:00
|
|
|
namespace Core::Memory {
|
2019-11-26 22:39:57 +00:00
|
|
|
class Memory;
|
|
|
|
}
|
|
|
|
|
2018-08-25 01:43:32 +00:00
|
|
|
namespace Core {
|
|
|
|
|
2020-03-02 04:46:10 +00:00
|
|
|
class DynarmicCallbacks64;
|
2018-07-03 13:28:46 +00:00
|
|
|
class DynarmicExclusiveMonitor;
|
2019-04-06 22:46:18 +00:00
|
|
|
class System;
|
2016-09-02 03:07:14 +00:00
|
|
|
|
2023-11-28 19:30:39 +00:00
|
|
|
class ArmDynarmic64 final : public ArmInterface {
|
2016-09-02 03:07:14 +00:00
|
|
|
public:
|
2023-11-28 19:30:39 +00:00
|
|
|
ArmDynarmic64(System& system, bool uses_wall_clock, const Kernel::KProcess* process,
|
|
|
|
DynarmicExclusiveMonitor& exclusive_monitor, std::size_t core_index);
|
|
|
|
~ArmDynarmic64() override;
|
2016-09-02 03:07:14 +00:00
|
|
|
|
2023-06-13 01:34:25 +00:00
|
|
|
Architecture GetArchitecture() const override {
|
2023-11-28 19:30:39 +00:00
|
|
|
return Architecture::AArch64;
|
2023-06-13 01:34:25 +00:00
|
|
|
}
|
2016-09-02 03:07:14 +00:00
|
|
|
|
2023-11-28 19:30:39 +00:00
|
|
|
HaltReason RunThread(Kernel::KThread* thread) override;
|
|
|
|
HaltReason StepThread(Kernel::KThread* thread) override;
|
2016-09-02 03:07:14 +00:00
|
|
|
|
2023-11-28 19:30:39 +00:00
|
|
|
void GetContext(Kernel::Svc::ThreadContext& ctx) const override;
|
|
|
|
void SetContext(const Kernel::Svc::ThreadContext& ctx) override;
|
|
|
|
void SetTpidrroEl0(u64 value) override;
|
|
|
|
|
|
|
|
void GetSvcArguments(std::span<uint64_t, 8> args) const override;
|
|
|
|
void SetSvcArguments(std::span<const uint64_t, 8> args) override;
|
|
|
|
u32 GetSvcNumber() const override;
|
|
|
|
|
|
|
|
void SignalInterrupt(Kernel::KThread* thread) override;
|
2016-09-02 03:07:14 +00:00
|
|
|
void ClearInstructionCache() override;
|
2023-03-18 01:26:04 +00:00
|
|
|
void InvalidateCacheRange(u64 addr, std::size_t size) override;
|
2018-01-09 21:33:46 +00:00
|
|
|
|
2022-05-31 18:37:37 +00:00
|
|
|
protected:
|
2022-06-06 16:56:01 +00:00
|
|
|
const Kernel::DebugWatchpoint* HaltedWatchpoint() const override;
|
|
|
|
void RewindBreakpointInstruction() override;
|
2022-05-31 18:37:37 +00:00
|
|
|
|
2018-01-09 21:33:46 +00:00
|
|
|
private:
|
2023-11-28 19:30:39 +00:00
|
|
|
System& m_system;
|
|
|
|
DynarmicExclusiveMonitor& m_exclusive_monitor;
|
2020-03-02 04:46:10 +00:00
|
|
|
|
2023-11-28 19:30:39 +00:00
|
|
|
private:
|
2020-03-02 04:46:10 +00:00
|
|
|
friend class DynarmicCallbacks64;
|
2021-03-24 11:08:41 +00:00
|
|
|
|
2023-11-28 19:30:39 +00:00
|
|
|
std::shared_ptr<Dynarmic::A64::Jit> MakeJit(Common::PageTable* page_table,
|
|
|
|
std::size_t address_space_bits) const;
|
|
|
|
std::unique_ptr<DynarmicCallbacks64> m_cb{};
|
|
|
|
std::size_t m_core_index{};
|
2022-04-10 14:46:29 +00:00
|
|
|
|
2023-11-28 19:30:39 +00:00
|
|
|
std::shared_ptr<Dynarmic::A64::Jit> m_jit{};
|
2021-05-27 20:54:22 +00:00
|
|
|
|
|
|
|
// SVC callback
|
2023-11-28 19:30:39 +00:00
|
|
|
u32 m_svc{};
|
2022-06-06 16:56:01 +00:00
|
|
|
|
2023-11-28 19:30:39 +00:00
|
|
|
// Watchpoint info
|
|
|
|
const Kernel::DebugWatchpoint* m_halted_watchpoint{};
|
|
|
|
Kernel::Svc::ThreadContext m_breakpoint_context{};
|
2016-09-02 03:07:14 +00:00
|
|
|
};
|
2018-07-03 13:28:46 +00:00
|
|
|
|
2018-08-25 01:43:32 +00:00
|
|
|
} // namespace Core
|