Files
FEX-Emu--FEX/ThunkLibs/libVDSO/libVDSO_Guest.cpp
T
Ryan Houdek 1596843015 VDSO: Fix vsyscall
The `mov ebp, ecx` was breaking vsyscall and was expected to be used
with the `syscall` instruction rather than `int 0x80`.
Remove that to fix it.

Also remove the pushes and pops around the syscall instruction, these
are unnecessary in an emulated environment, we won't clobber the
registers.

Fixes Steam execution with VDSO.
2022-09-28 17:34:24 -07:00

43 lines
1.0 KiB
C++

/*
$info$
tags: thunklibs|VDSO
desc: Linux VDSO thunking
$end_info$
*/
#include <stdio.h>
#include <cstring>
#include <sched.h>
#include <sys/time.h>
#include <time.h>
#include "Types.h"
#include "common/Guest.h"
#include "thunkgen_guest_libVDSO.inl"
extern "C" {
time_t __vdso_time(time_t *tloc) __attribute__((alias("fexfn_pack_time")));
int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) __attribute__((alias("fexfn_pack_gettimeofday")));
int __vdso_clock_gettime(clockid_t, struct timespec *) __attribute__((alias("fexfn_pack_clock_gettime")));
int __vdso_clock_getres(clockid_t, struct timespec *) __attribute__((alias("fexfn_pack_clock_getres")));
int __vdso_getcpu(uint32_t *, uint32_t *) __attribute__((alias("fexfn_pack_getcpu")));
#if __SIZEOF_POINTER__ == 4
int __vdso_clock_gettime64(clockid_t, struct timespec64 *) __attribute__((alias("fexfn_pack_clock_gettime64")));
__attribute__((naked))
int __kernel_vsyscall() {
asm volatile(R"(
.intel_syntax noprefix
int 0x80;
ret;
.att_syntax prefix
)"
::: "memory");
}
#endif
}