From cb7feaefbb0c4e1e59839ef1ec7dcbcdc4296d4d Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 9 Jan 2022 00:00:13 -0800 Subject: [PATCH] Types: Allows passing 64-bit host siginfo_t to 32-bit siginfo_t Needed for waitid --- External/FEXCore/include/FEXCore/Core/UContext.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/External/FEXCore/include/FEXCore/Core/UContext.h b/External/FEXCore/include/FEXCore/Core/UContext.h index 8d4450898..3a9be4ab7 100644 --- a/External/FEXCore/include/FEXCore/Core/UContext.h +++ b/External/FEXCore/include/FEXCore/Core/UContext.h @@ -172,6 +172,16 @@ namespace FEXCore { return val; } + + siginfo_t(::siginfo_t val) { + si_signo = val.si_signo; + si_errno = val.si_errno; + si_code = val.si_code; + + // Copy over the union + // The union is different sizes on 64-bit versus 32-bit + memcpy(val._sifields._pad, _sifields.pad, std::min(sizeof(val._sifields._pad), sizeof(_sifields.pad))); + } }; static_assert(sizeof(FEXCore::x86::siginfo_t) == 128, "This needs to be the right size");