unittests/FEXLinuxTests: Adds 64-bit vsyscall test

We never actually had a unittest to ensure these keep working, so add
one now.
This commit is contained in:
Ryan Houdek committed 2026-06-03 18:03:31 -07:00
1 parent ac12dd55c3
commit ba56f8e0c5
1 file changed
+26
@@ -0,0 +1,26 @@
#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;
}