cpu: fix MinGW-w64 build. Closes #237

* Fixed by Jeffrey Walton (noloader)
pull/239/head
anonimal 2016-08-01 19:56:43 +00:00
parent 3f6d499c19
commit bf9809ef57
No known key found for this signature in database
GPG Key ID: 66A76ECF914409F1
1 changed files with 10 additions and 0 deletions

10
cpu.cpp
View File

@ -101,9 +101,11 @@ bool CpuId(word32 input, word32 output[4])
if (oldHandler == SIG_ERR) if (oldHandler == SIG_ERR)
return false; return false;
# ifndef __MINGW32__
volatile sigset_t oldMask; volatile sigset_t oldMask;
if (sigprocmask(0, NULL, (sigset_t*)&oldMask)) if (sigprocmask(0, NULL, (sigset_t*)&oldMask))
return false; return false;
# endif
if (setjmp(s_jmpNoCPUID)) if (setjmp(s_jmpNoCPUID))
result = false; result = false;
@ -123,7 +125,10 @@ bool CpuId(word32 input, word32 output[4])
); );
} }
# ifndef __MINGW32__
sigprocmask(SIG_SETMASK, (sigset_t*)&oldMask, NULL); sigprocmask(SIG_SETMASK, (sigset_t*)&oldMask, NULL);
# endif
signal(SIGILL, oldHandler); signal(SIGILL, oldHandler);
return result; return result;
#endif #endif
@ -160,9 +165,11 @@ static bool TrySSE2()
if (oldHandler == SIG_ERR) if (oldHandler == SIG_ERR)
return false; return false;
# ifndef __MINGW32__
volatile sigset_t oldMask; volatile sigset_t oldMask;
if (sigprocmask(0, NULL, (sigset_t*)&oldMask)) if (sigprocmask(0, NULL, (sigset_t*)&oldMask))
return false; return false;
# endif
if (setjmp(s_jmpNoSSE2)) if (setjmp(s_jmpNoSSE2))
result = false; result = false;
@ -176,7 +183,10 @@ static bool TrySSE2()
#endif #endif
} }
# ifndef __MINGW32__
sigprocmask(SIG_SETMASK, (sigset_t*)&oldMask, NULL); sigprocmask(SIG_SETMASK, (sigset_t*)&oldMask, NULL);
# endif
signal(SIGILL, oldHandler); signal(SIGILL, oldHandler);
return result; return result;
#endif #endif