mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 09:00:17 +02:00
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:
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;
|
||||
}
|
||||
Reference in new issue
Block a user