This commit is contained in:
Igor Pavlov
2023-12-22 17:17:05 +00:00
committed by Kornel
parent ec44a8a070
commit a36c48cece
954 changed files with 42199 additions and 25482 deletions

View File

@@ -5,6 +5,7 @@
#ifdef _WIN32
#include "../../../../C/DllSecur.h"
#endif
#include "../../../../C/CpuArch.h"
#include "../../../Common/MyException.h"
#include "../../../Common/StdOutStream.h"
@@ -56,7 +57,44 @@ static void PrintError(const char *message)
#define NT_CHECK_FAIL_ACTION *g_StdStream << "Unsupported Windows version"; return NExitCode::kFatalError;
#endif
int MY_CDECL main
static inline bool CheckIsa()
{
// __try
{
#if defined(__AVX2__)
if (!CPU_IsSupported_AVX2())
return false;
#elif defined(__AVX__)
if (!CPU_IsSupported_AVX())
return false;
#elif defined(__SSE2__) && !defined(MY_CPU_AMD64) || defined(_M_IX86_FP) && (_M_IX86_FP >= 2)
if (!CPU_IsSupported_SSE2())
return false;
#elif defined(__SSE__) && !defined(MY_CPU_AMD64) || defined(_M_IX86_FP) && (_M_IX86_FP >= 1)
if (!CPU_IsSupported_SSE() ||
!CPU_IsSupported_CMOV())
return false;
#endif
/*
__asm
{
_emit 0fH
_emit 038H
_emit 0cbH
_emit (0c0H + 0 * 8 + 0)
}
*/
return true;
}
/*
__except (EXCEPTION_EXECUTE_HANDLER)
{
return false;
}
*/
}
int Z7_CDECL main
(
#ifndef _WIN32
int numArgs, char *args[]
@@ -66,6 +104,14 @@ int MY_CDECL main
g_ErrStream = &g_StdErr;
g_StdStream = &g_StdOut;
// #if (defined(_MSC_VER) && defined(_M_IX86))
if (!CheckIsa())
{
PrintError("ERROR: processor doesn't support required ISA extension");
return NExitCode::kFatalError;
}
// #endif
NT_CHECK
NConsoleClose::CCtrlHandlerSetter ctrlHandlerSetter;
@@ -119,7 +165,7 @@ int MY_CDECL main
}
return (NExitCode::kFatalError);
}
catch(NExitCode::EEnum &exitCode)
catch(NExitCode::EEnum exitCode)
{
FlushStreams();
if (g_ErrStream)