Files
FEX-Emu--FEX/Source/Tools/LinuxEmulation/VDSO_Emulation.h
T
Ryan Houdek 42d0324304 FEX: Moves FEX thunk callback function generation to the frontend
Adds it to the VDSO handling, it's not necessarily a VDSO function but
it behaves as such as it is in every single process. This means we get
to reuse the mapped page for every process when thunks are built,
shaving a page out of 32-bit processes.

Also, fixes a bug in guest VDSO symbol loading where clang sticks all
symbols in to `.dynsym` where gcc sticks them in to `.symtab`. Search
both. This effectively meant the couple of guest VDSO symbols were
always failing to get found, causing us to allocate yet another page on
32-bit. So effectively three pages stolen.

This also means we can remove the Linux specific X86HelperGen stuff from
FEXCore, only passing a single "VDSO" function pointer to the backend
for the dispatcher. Once again moving the Linux stuff to the frontend is
good.

Fixes an assert about about untracked noexec code `NoExec
instruction in entry block: FFFFE000` whenever thunk callbacks were
used.
2025-11-18 14:15:04 -08:00

35 lines
791 B
C++

// SPDX-License-Identifier: MIT
#pragma once
#include <FEXCore/IR/IR.h>
#include <cstddef>
#include <cstdint>
#include <span>
namespace FEX::HLE {
class SyscallHandler;
}
namespace FEX::VDSO {
struct VDSOMapping {
void* VDSOBase {};
size_t VDSOSize {};
void* X86GeneratedCodePtr {};
size_t X86GeneratedCodeSize {};
};
struct VDSOEntrypoints {
void* VDSO_kernel_sigreturn;
void* VDSO_kernel_rt_sigreturn;
void* VDSO_FEX_CallbackRET;
};
VDSOMapping LoadVDSOThunks(bool Is64Bit, FEX::HLE::SyscallHandler* const Handler);
void UnloadVDSOMapping(const VDSOMapping& Mapping);
uint64_t GetVSyscallEntry(const void* VDSOBase);
const std::span<FEXCore::IR::ThunkDefinition> GetVDSOThunkDefinitions(bool Is64Bit);
const VDSOEntrypoints& GetVDSOSymbols();
} // namespace FEX::VDSO