diff options
Diffstat (limited to 'src/common/arm64')
| -rw-r--r-- | src/common/arm64/native_clock.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/common/arm64/native_clock.cpp b/src/common/arm64/native_clock.cpp index 88fdba527..f437d7187 100644 --- a/src/common/arm64/native_clock.cpp +++ b/src/common/arm64/native_clock.cpp | |||
| @@ -1,6 +1,9 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #ifdef ANDROID | ||
| 5 | #include <sys/system_properties.h> | ||
| 6 | #endif | ||
| 4 | #include "common/arm64/native_clock.h" | 7 | #include "common/arm64/native_clock.h" |
| 5 | 8 | ||
| 6 | namespace Common::Arm64 { | 9 | namespace Common::Arm64 { |
| @@ -65,7 +68,23 @@ bool NativeClock::IsNative() const { | |||
| 65 | 68 | ||
| 66 | u64 NativeClock::GetHostCNTFRQ() { | 69 | u64 NativeClock::GetHostCNTFRQ() { |
| 67 | u64 cntfrq_el0 = 0; | 70 | u64 cntfrq_el0 = 0; |
| 68 | asm("mrs %[cntfrq_el0], cntfrq_el0" : [cntfrq_el0] "=r"(cntfrq_el0)); | 71 | std::string_view board{""}; |
| 72 | #ifdef ANDROID | ||
| 73 | char buffer[PROP_VALUE_MAX]; | ||
| 74 | int len{__system_property_get("ro.product.board", buffer)}; | ||
| 75 | board = std::string_view(buffer, static_cast<size_t>(len)); | ||
| 76 | #endif | ||
| 77 | if (board == "s5e9925") { // Exynos 2200 | ||
| 78 | cntfrq_el0 = 25600000; | ||
| 79 | } else if (board == "exynos2100") { // Exynos 2100 | ||
| 80 | cntfrq_el0 = 26000000; | ||
| 81 | } else if (board == "exynos9810") { // Exynos 9810 | ||
| 82 | cntfrq_el0 = 26000000; | ||
| 83 | } else if (board == "s5e8825") { // Exynos 1280 | ||
| 84 | cntfrq_el0 = 26000000; | ||
| 85 | } else { | ||
| 86 | asm("mrs %[cntfrq_el0], cntfrq_el0" : [cntfrq_el0] "=r"(cntfrq_el0)); | ||
| 87 | } | ||
| 69 | return cntfrq_el0; | 88 | return cntfrq_el0; |
| 70 | } | 89 | } |
| 71 | 90 | ||