Skip to content

Commit

Permalink
Fixes VDSO crash in 64-bit code
Browse files Browse the repository at this point in the history
Ever since #3406 this has been crashing. Struct tail padding was saving
this before.
  • Loading branch information
Sonicadvance1 committed Feb 18, 2024
1 parent 5769ffb commit 40f9f13
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions Source/Tools/LinuxEmulation/VDSO_Emulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace FEX::VDSO {

using HandlerPtr = void(*)(void*);
namespace x64 {
static uint64_t SyscallRet(int Result) {
static int SyscallRet(int Result) {
if (Result == -1) {
return -errno;
}
Expand All @@ -47,7 +47,7 @@ namespace FEX::VDSO {
static void time(void* ArgsRV) {
struct __attribute__((packed)) ArgsRV_t {
time_t *a_0;
uint64_t rv;
int rv;
} *args = reinterpret_cast<ArgsRV_t*>(ArgsRV);

int Result = ::time(args->a_0);
Expand All @@ -58,7 +58,7 @@ namespace FEX::VDSO {
struct __attribute__((packed)) ArgsRV_t {
struct timeval *tv;
struct timezone *tz;
uint64_t rv;
int rv;
} *args = reinterpret_cast<ArgsRV_t*>(ArgsRV);

int Result = ::gettimeofday(args->tv, args->tz);
Expand All @@ -69,7 +69,7 @@ namespace FEX::VDSO {
struct __attribute__((packed)) ArgsRV_t {
clockid_t clk_id;
struct timespec *tp;
uint64_t rv;
int rv;
} *args = reinterpret_cast<ArgsRV_t*>(ArgsRV);

int Result = ::clock_gettime(args->clk_id, args->tp);
Expand All @@ -80,7 +80,7 @@ namespace FEX::VDSO {
struct __attribute__((packed)) ArgsRV_t {
clockid_t clk_id;
struct timespec *tp;
uint64_t rv;
int rv;
} *args = reinterpret_cast<ArgsRV_t*>(ArgsRV);

int Result = ::clock_getres(args->clk_id, args->tp);
Expand All @@ -91,7 +91,7 @@ namespace FEX::VDSO {
struct __attribute__((packed)) ArgsRV_t {
uint32_t *cpu;
uint32_t *node;
uint64_t rv;
int rv;
} *args = reinterpret_cast<ArgsRV_t*>(ArgsRV);

int Result = FHU::Syscalls::getcpu(args->cpu, args->node);
Expand All @@ -104,7 +104,7 @@ namespace FEX::VDSO {
static void time(void* ArgsRV) {
struct __attribute__((packed)) ArgsRV_t {
time_t *a_0;
uint64_t rv;
int rv;
} *args = reinterpret_cast<ArgsRV_t*>(ArgsRV);

args->rv = VDSOHandlers::TimePtr(args->a_0);
Expand All @@ -114,7 +114,7 @@ namespace FEX::VDSO {
struct __attribute__((packed)) ArgsRV_t {
struct timeval *tv;
struct timezone *tz;
uint64_t rv;
int rv;
} *args = reinterpret_cast<ArgsRV_t*>(ArgsRV);

args->rv = VDSOHandlers::GetTimeOfDayPtr(args->tv, args->tz);
Expand All @@ -124,7 +124,7 @@ namespace FEX::VDSO {
struct __attribute__((packed)) ArgsRV_t {
clockid_t clk_id;
struct timespec *tp;
uint64_t rv;
int rv;
} *args = reinterpret_cast<ArgsRV_t*>(ArgsRV);

args->rv = VDSOHandlers::ClockGetTimePtr(args->clk_id, args->tp);
Expand All @@ -134,7 +134,7 @@ namespace FEX::VDSO {
struct __attribute__((packed)) ArgsRV_t {
clockid_t clk_id;
struct timespec *tp;
uint64_t rv;
int rv;
} *args = reinterpret_cast<ArgsRV_t*>(ArgsRV);

args->rv = VDSOHandlers::ClockGetResPtr(args->clk_id, args->tp);
Expand All @@ -144,7 +144,7 @@ namespace FEX::VDSO {
struct __attribute__((packed)) ArgsRV_t {
uint32_t *cpu;
uint32_t *node;
uint64_t rv;
int rv;
} *args = reinterpret_cast<ArgsRV_t*>(ArgsRV);

args->rv = VDSOHandlers::GetCPUPtr(args->cpu, args->node);
Expand Down

0 comments on commit 40f9f13

Please sign in to comment.