mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-22 16:30:57 +01:00
arm: NativeClock: Special handling for bad system counter clock frequency reporting
On some devices, checking the system counter clock frequency will return 0. Substitute in the correct values to prevent issues.
This commit is contained in:
parent
d6e6ab11b1
commit
4b321c003c
1 changed files with 20 additions and 1 deletions
|
@ -1,6 +1,9 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
#include <sys/system_properties.h>
|
||||||
|
#endif
|
||||||
#include "common/arm64/native_clock.h"
|
#include "common/arm64/native_clock.h"
|
||||||
|
|
||||||
namespace Common::Arm64 {
|
namespace Common::Arm64 {
|
||||||
|
@ -65,7 +68,23 @@ bool NativeClock::IsNative() const {
|
||||||
|
|
||||||
u64 NativeClock::GetHostCNTFRQ() {
|
u64 NativeClock::GetHostCNTFRQ() {
|
||||||
u64 cntfrq_el0 = 0;
|
u64 cntfrq_el0 = 0;
|
||||||
asm("mrs %[cntfrq_el0], cntfrq_el0" : [cntfrq_el0] "=r"(cntfrq_el0));
|
std::string_view board{""};
|
||||||
|
#ifdef ANDROID
|
||||||
|
char buffer[PROP_VALUE_MAX];
|
||||||
|
int len{__system_property_get("ro.product.board", buffer)};
|
||||||
|
board = std::string_view(buffer, static_cast<size_t>(len));
|
||||||
|
#endif
|
||||||
|
if (board == "s5e9925") { // Exynos 2200
|
||||||
|
cntfrq_el0 = 25600000;
|
||||||
|
} else if (board == "exynos2100") { // Exynos 2100
|
||||||
|
cntfrq_el0 = 26000000;
|
||||||
|
} else if (board == "exynos9810") { // Exynos 9810
|
||||||
|
cntfrq_el0 = 26000000;
|
||||||
|
} else if (board == "s5e8825") { // Exynos 1280
|
||||||
|
cntfrq_el0 = 26000000;
|
||||||
|
} else {
|
||||||
|
asm("mrs %[cntfrq_el0], cntfrq_el0" : [cntfrq_el0] "=r"(cntfrq_el0));
|
||||||
|
}
|
||||||
return cntfrq_el0;
|
return cntfrq_el0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue