fixup nce

This commit is contained in:
lizzie 2026-04-21 16:55:33 +00:00
parent bf38b38184
commit 13b6d88537
2 changed files with 12 additions and 6 deletions

View file

@ -136,10 +136,12 @@ s64 WallClock::GetGPUTick() const {
s64 WallClock::GetUptime() const { s64 WallClock::GetUptime() const {
s64 cntvct_el0 = 0; s64 cntvct_el0 = 0;
asm volatile("dsb ish\n\t" asm volatile(
"mrs %[cntvct_el0], cntvct_el0\n\t" "dsb ish\n\t"
"dsb ish\n\t" "mrs %[cntvct_el0], cntvct_el0\n\t"
: [cntvct_el0] "=r"(cntvct_el0)); "dsb ish\n\t"
: [cntvct_el0] "=r"(cntvct_el0)
);
return cntvct_el0; return cntvct_el0;
} }

View file

@ -3,7 +3,7 @@
#include <numeric> #include <numeric>
#include <bit> #include <bit>
#include "common/arm64/native_clock.h" #include "common/wall_clock.h"
#include "common/alignment.h" #include "common/alignment.h"
#include "common/literals.h" #include "common/literals.h"
#include "core/arm/nce/arm_nce.h" #include "core/arm/nce/arm_nce.h"
@ -578,7 +578,11 @@ void Patcher::WriteMsrHandler(ModuleDestLabel module_dest, oaknut::XReg src_reg,
} }
void Patcher::WriteCntpctHandler(ModuleDestLabel module_dest, oaknut::XReg dest_reg, oaknut::VectorCodeGenerator& cg) { void Patcher::WriteCntpctHandler(ModuleDestLabel module_dest, oaknut::XReg dest_reg, oaknut::VectorCodeGenerator& cg) {
static Common::WallClock clock{}; #if defined(HAS_NCE)
static Common::WallClock clock(false, 1);
#else
static Common::WallClock clock(true, 1);
#endif
const auto factor = clock.GetGuestCNTFRQFactor(); const auto factor = clock.GetGuestCNTFRQFactor();
const auto raw_factor = std::bit_cast<std::array<u64, 2>>(factor); const auto raw_factor = std::bit_cast<std::array<u64, 2>>(factor);