Files
FEX-Emu--FEX/unittests/FEXLinuxTests/tests/syscalls/vsyscall.64.cpp
T
Ryan Houdek ba56f8e0c5 unittests/FEXLinuxTests: Adds 64-bit vsyscall test
We never actually had a unittest to ensure these keep working, so add
one now.
2026-06-03 18:03:31 -07:00

27 lines
727 B
C++

#include <cstdint>
#include <sys/time.h>
using gettime_type = int (*)(struct timeval* tv, struct timezone* tz);
gettime_type gettimeofday_vsyscall = (gettime_type)0xFFFF'FFFF'FF60'0000ULL;
using time_type = int (*)(time_t* tloc);
time_type time_vsyscall = (time_type)0xFFFF'FFFF'FF60'0400ULL;
using getcpu_type = int (*)(uint32_t* cpu, uint32_t* node);
getcpu_type getcpu_vsyscall = (getcpu_type)0xFFFF'FFFF'FF60'0800ULL;
int main() {
// This test just ensures that these vsyscalls execute without crashing.
// FEX has broken vsyscalls periodically.
timeval tv {};
gettimeofday_vsyscall(&tv, nullptr);
time_t tloc {};
time_vsyscall(&tloc);
uint32_t cpu, node;
getcpu_vsyscall(&cpu, &node);
return 0;
}