[*] Win32 32bit regression fixes

This commit is contained in:
Reece Wilson 2022-03-18 07:32:38 +00:00
parent ff88b7f85d
commit d406e5a85e
4 changed files with 27 additions and 21 deletions

View File

@ -83,11 +83,13 @@ inline auline AuInt16 AuAtomicUtils<AuInt16>::CompareExchange(AuInt16 *in, AuInt
return _InterlockedCompareExchange16(reinterpret_cast<short volatile *>(in), static_cast<short>(replace), static_cast<short>(compare));
}
#if !defined(AURORA_IS_32BIT)
template<>
inline auline AuUInt64 AuAtomicUtils<AuUInt64>::Add(AuUInt64 *in, AuUInt64 addend)
{
return static_cast<AuUInt64>(_InterlockedExchangeAdd64(reinterpret_cast<long long volatile *>(in), static_cast<long long>(addend)) + static_cast<long long>(addend));
}
#endif
template<>
inline auline AuUInt32 AuAtomicUtils<AuUInt32>::Add(AuUInt32 *in, AuUInt32 addend)
@ -95,11 +97,13 @@ inline auline AuUInt32 AuAtomicUtils<AuUInt32>::Add(AuUInt32 *in, AuUInt32 adden
return static_cast<AuUInt32>(_InterlockedExchangeAdd(reinterpret_cast<long volatile *>(in), static_cast<long>(addend)) + static_cast<long>(addend));
}
#if !defined(AURORA_IS_32BIT)
template<>
inline auline AuInt64 AuAtomicUtils<AuInt64>::Add(AuInt64 *in, AuInt64 addend)
{
return _InterlockedExchangeAdd64(reinterpret_cast<long long volatile *>(in), static_cast<long long>(addend)) + static_cast<long long>(addend);
}
#endif
template<>
inline auline AuInt32 AuAtomicUtils<AuInt32>::Add(AuInt32 *in, AuInt32 addend)
@ -139,11 +143,13 @@ inline auline AuUInt16 AuAtomicUtils<AuUInt16>::Sub(AuUInt16 *in, AuUInt16 minue
#endif
#if !defined(AURORA_IS_32BIT)
template<>
inline auline AuUInt64 AuAtomicUtils<AuUInt64>::Set(AuUInt64 *in, AuUInt8 offset)
{
return _InterlockedOr64(reinterpret_cast<long long volatile *>(in), AuUInt64(1) << offset);
}
#endif
template<>
inline auline AuUInt32 AuAtomicUtils<AuUInt32>::Set(AuUInt32 *in, AuUInt8 offset)
@ -157,12 +163,13 @@ inline auline AuUInt16 AuAtomicUtils<AuUInt16>::Set(AuUInt16 *in, AuUInt8 offset
return _InterlockedOr16(reinterpret_cast<short volatile *>(in), 1 << offset);
}
#if !defined(AURORA_IS_32BIT)
template<>
inline auline AuInt64 AuAtomicUtils<AuInt64>::Set(AuInt64 *in, AuUInt8 offset)
{
return _InterlockedOr64(reinterpret_cast<long long volatile *>(in), AuUInt64(1) << offset);
}
#endif
template<>
inline auline AuInt32 AuAtomicUtils<AuInt32>::Set(AuInt32 *in, AuUInt8 offset)
@ -248,6 +255,7 @@ inline auline bool AuAtomicUtils<AuInt32>::TestAndSet(AuInt32 *in, const AuUInt8
return _interlockedbittestandset(reinterpret_cast<volatile long *>(in), offset);
}
#if !defined(AURORA_IS_32BIT)
template<>
inline auline bool AuAtomicUtils<AuUInt64>::TestAndSet(AuUInt64 *in, const AuUInt8 offset)
{
@ -259,6 +267,7 @@ inline auline bool AuAtomicUtils<AuInt64>::TestAndSet(AuInt64 *in, const AuUInt8
{
return _interlockedbittestandset64(reinterpret_cast<volatile long long *>(in), offset);
}
#endif
#endif

View File

@ -44,21 +44,20 @@ namespace Aurora::Debug
{
AuString message;
if (handle && handle != INVALID_HANDLE_VALUE)
if (handle != INVALID_HANDLE_VALUE)
{
try
{
const ThrowInfo *pthrowInfo = reinterpret_cast<const ThrowInfo *>(throwInfo);
auto attribs = pthrowInfo->attributes;
const auto catchableTypeArray = reinterpret_cast<const CatchableTypeArray *>(reinterpret_cast<AuUInt>(handle) + static_cast<AuUInt>(pthrowInfo->pCatchableTypeArray));
const auto catchableTypeArray = reinterpret_cast<const CatchableTypeArray *>(reinterpret_cast<AuUInt>(handle) + (AuUInt)(pthrowInfo->pCatchableTypeArray));
AuString suffix;
for (int i = 0; i < catchableTypeArray->nCatchableTypes; i++)
{
const auto type = reinterpret_cast<CatchableType *> (reinterpret_cast<AuUInt>(handle) + static_cast<AuUInt>(catchableTypeArray->arrayOfCatchableTypes[i]));
const auto descriptor = reinterpret_cast<std::type_info *> (reinterpret_cast<AuUInt>(handle) + static_cast<AuUInt>(type->pType));
const auto type = reinterpret_cast<CatchableType *> (reinterpret_cast<AuUInt>(handle) + (AuUInt *)(catchableTypeArray->arrayOfCatchableTypes[i]));
const auto descriptor = reinterpret_cast<std::type_info *> (reinterpret_cast<AuUInt>(handle) + (AuUInt *)(type->pType));
message += (i == 0 ? "" : AuString(", ")) + descriptor->name(); // __std_type_info_name
@ -224,11 +223,6 @@ extern "C" AUKN_SYM void __stdcall _ReportMSVCSEH(void *exception, const void *t
}
}
if (!handle)
{
return;
}
if (handle == INVALID_HANDLE_VALUE)
{
return;

View File

@ -105,7 +105,7 @@ namespace Aurora::Debug
return (info.Protect & (PAGE_READONLY | PAGE_READWRITE)) != 0;
}
static LONG HandleVectorException(_EXCEPTION_POINTERS *ExceptionInfo)
static LONG CALLBACK HandleVectorException(_EXCEPTION_POINTERS *ExceptionInfo)
{
if (ExceptionInfo->ExceptionRecord->ExceptionCode < STATUS_GUARD_PAGE_VIOLATION)
{
@ -138,7 +138,7 @@ namespace Aurora::Debug
ThrowInfo *pThrowInfo {};
if ((ExceptionInfo->ExceptionRecord->ExceptionCode == EH_EXCEPTION_NUMBER) &&
(ExceptionInfo->ExceptionRecord->NumberParameters >= 4) &&
(ExceptionInfo->ExceptionRecord->NumberParameters >= 3) &&
((cxxThrow) ||
(cxxThrowPure))
)
@ -183,6 +183,8 @@ namespace Aurora::Debug
bool isInternal = false;
#endif
if (pThrowInfo)
{
ReportSEH(handle, exception, pThrowInfo, handleNoCppObject, backtrace, [&](const AuString &str)
{
// Pre-submit callback -> its showtime
@ -192,6 +194,7 @@ namespace Aurora::Debug
AuLogWarn("{}", StringifyStackTrace(backtrace));
}
});
}
try
{

View File

@ -67,7 +67,7 @@ namespace Aurora::Processes
AuUInt32 count;
};
static BOOL TermWinHandleWin32Thread(HWND handle, LPARAM a)
static BOOL CALLBACK TermWinHandleWin32Thread(HWND handle, LPARAM a)
{
DWORD windowpid;
auto context = reinterpret_cast<Hack *>(a);