From f298278f372292f614889bfecd7eda343ea2920d Mon Sep 17 00:00:00 2001 From: Merry Date: Sat, 19 Nov 2022 21:54:21 +0000 Subject: [PATCH] arm/dynarmic: Initial implementation for instruction tick counts --- src/core/CMakeLists.txt | 2 ++ src/core/arm/dynarmic/arm_dynarmic.cpp | 4 ++++ src/core/arm/dynarmic/arm_tick_counts.cpp | 16 ++++++++++++++++ src/core/arm/dynarmic/arm_tick_counts.h | 13 +++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 src/core/arm/dynarmic/arm_tick_counts.cpp create mode 100644 src/core/arm/dynarmic/arm_tick_counts.h diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index e1738e9f66..d57aef53e9 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -492,6 +492,8 @@ if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) arm/dynarmic/arm_dynarmic_cp15.h arm/dynarmic/arm_exclusive_monitor.cpp arm/dynarmic/arm_exclusive_monitor.h + arm/dynarmic/arm_tick_counts.cpp + arm/dynarmic/arm_tick_counts.h ) target_link_libraries(core PRIVATE dynarmic) endif() diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index 09fdb99b52..eea63f07fe 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp @@ -11,6 +11,7 @@ #include "core/arm/dynarmic/arm_dynarmic.h" #include "core/arm/dynarmic/arm_dynarmic_cp15.h" #include "core/arm/dynarmic/arm_exclusive_monitor.h" +#include "core/arm/dynarmic/arm_tick_counts.h" #include "core/core.h" #include "core/core_timing.h" #include "core/gdbstub/gdbstub.h" @@ -161,6 +162,9 @@ public: s64 ticks = parent.GetTimer().GetDowncount(); return static_cast(ticks <= 0 ? 0 : ticks); } + std::uint64_t GetTicksForCode(bool is_thumb, VAddr, std::uint32_t instruction) override { + return Core::TicksForInstruction(is_thumb, instruction); + } ARM_Dynarmic& parent; Kernel::SVCContext svc_context; diff --git a/src/core/arm/dynarmic/arm_tick_counts.cpp b/src/core/arm/dynarmic/arm_tick_counts.cpp new file mode 100644 index 0000000000..3a3af41f83 --- /dev/null +++ b/src/core/arm/dynarmic/arm_tick_counts.cpp @@ -0,0 +1,16 @@ +// Copyright 2022 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/common_types.h" +#include "core/arm/dynarmic/arm_tick_counts.h" + +namespace Core { + +u64 TicksForInstruction(bool is_thumb, u32 instruction) { + (void)is_thumb; + (void)instruction; + return 1; +} + +} // namespace Core diff --git a/src/core/arm/dynarmic/arm_tick_counts.h b/src/core/arm/dynarmic/arm_tick_counts.h new file mode 100644 index 0000000000..b6051522b0 --- /dev/null +++ b/src/core/arm/dynarmic/arm_tick_counts.h @@ -0,0 +1,13 @@ +// Copyright 2022 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "common/common_types.h" + +namespace Core { + +u64 TicksForInstruction(bool is_thumb, u32 instruction); + +} // namespace Core