mirror of
https://github.com/Liondarkz/issn_pc.git
synced 2026-11-07 12:47:50 -10:00
sceKernelReadTsc devolvia o rdtsc cru, e em hosts com TSC diferente por núcleo (3,9 s entre núcleos num Xeon E5-2680 v4) o jogo saltava no tempo quando uma thread trocava de núcleo. O TSC passa a ser o contador do processo em nanossegundos (QPC no Windows), com frequência de 1 GHz, no runtime e na biblioteca de GPU. Refs #42
27 lines
1.4 KiB
C++
27 lines
1.4 KiB
C++
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
#include <cstdlib>
|
|
#include <chrono>
|
|
#include <cstdint>
|
|
#include <cstddef>
|
|
#include <setjmp.h>
|
|
// Renderer tests have no guest process. Clock/host-thread services work; guest accesses abort.
|
|
extern "C" {
|
|
thread_local sigjmp_buf* runtime_fault_recover = nullptr;
|
|
uint32_t runtime_disabled_optimizations = 0;
|
|
uint64_t runtime_tsc_frequency() { return 1000000000; }
|
|
int runtime_file_translate(const char*, char*, size_t) { std::abort(); }
|
|
uint64_t runtime_memory_clamp(uintptr_t, uint64_t) { std::abort(); }
|
|
uint64_t runtime_process_time_us() { return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now().time_since_epoch()).count(); }
|
|
int runtime_memory_region(uintptr_t, uintptr_t*, uintptr_t*, int*) { std::abort(); }
|
|
void runtime_memory_set_gpu_hooks(void (*)(uintptr_t, uint64_t),
|
|
void (*)(uintptr_t, uint64_t), void (*)(uintptr_t, uint64_t)) { std::abort(); }
|
|
void runtime_thread_attach_host(const char*) {}
|
|
void runtime_memory_gpu_protect(uintptr_t, uint64_t, int, int) { std::abort(); }
|
|
void runtime_restart() { std::abort(); }
|
|
uint64_t runtime_process_time_counter() { return runtime_process_time_us() * 1000; }
|
|
uint64_t runtime_read_tsc() { return runtime_process_time_counter(); }
|
|
int32_t* runtime_errno() { std::abort(); }
|
|
int runtime_memory_write_backing(uintptr_t, const void*, uint64_t) { std::abort(); }
|
|
}
|
|
|