P4 to Git Change 1102693 by jsjodin@jsjodin_linux_avx_hsa on 2014/12/04 17:11:26
ECR #304775 - Change the way SIGFPE is handled. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpucommand.hpp#38 edit ... //depot/stg/opencl/drivers/opencl/runtime/os/os_posix.cpp#39 edit ... //depot/stg/opencl/drivers/opencl/runtime/os/os_win32.cpp#42 edit ... //depot/stg/opencl/drivers/opencl/runtime/thread/thread.hpp#14 edit
This commit is contained in:
@@ -353,6 +353,8 @@ public:
|
||||
loop();
|
||||
}
|
||||
|
||||
bool isWorkerThread() const { return true; }
|
||||
|
||||
//! Return the currently executing WorkerThread's instance.
|
||||
static WorkerThread* current()
|
||||
{
|
||||
|
||||
@@ -96,18 +96,7 @@ divisionErrorHandler(int sig, siginfo_t* info, void* ptr)
|
||||
assert(!"Unimplemented");
|
||||
#endif
|
||||
|
||||
// Call the chained signal handler
|
||||
if (callOldSignalHandler(sig, info, ptr)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// @todo: only handle exception in the generated code.
|
||||
//
|
||||
//if (!isKernelCode(insn)) {
|
||||
// return;
|
||||
//}
|
||||
|
||||
if (sig == SIGFPE && info->si_code == FPE_INTDIV) {
|
||||
if(Thread::current()->isWorkerThread()) {
|
||||
if (Os::skipIDIV(insn)) {
|
||||
#if defined(ATI_ARCH_X86)
|
||||
uc->uc_mcontext.gregs[LP64_SWITCH(REG_EIP,REG_RIP)] = (greg_t)insn;
|
||||
@@ -118,6 +107,12 @@ divisionErrorHandler(int sig, siginfo_t* info, void* ptr)
|
||||
}
|
||||
}
|
||||
|
||||
// Call the chained signal handler
|
||||
if (callOldSignalHandler(sig, info, ptr)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
std::cerr << "Unhandled signal in divisionErrorHandler()" << std::endl;
|
||||
::abort();
|
||||
}
|
||||
|
||||
@@ -450,15 +450,11 @@ divExceptionFilter(struct _EXCEPTION_POINTERS* ep)
|
||||
{
|
||||
DWORD code = ep->ExceptionRecord->ExceptionCode;
|
||||
|
||||
if (code == EXCEPTION_INT_DIVIDE_BY_ZERO
|
||||
|| code == EXCEPTION_INT_OVERFLOW) {
|
||||
// @todo: only handle exception in the generated code.
|
||||
//
|
||||
//if (!isKernelCode(insn)) {
|
||||
// return;
|
||||
//}
|
||||
if (code == EXCEPTION_INT_DIVIDE_BY_ZERO ||
|
||||
code == EXCEPTION_INT_OVERFLOW) {
|
||||
|
||||
address insn = (address)ep->ContextRecord->LP64_SWITCH(Eip,Rip);
|
||||
|
||||
if (Os::skipIDIV(insn)) {
|
||||
ep->ContextRecord->LP64_SWITCH(Eip,Rip) = (uintptr_t)insn;
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
@@ -471,9 +467,8 @@ void*
|
||||
Thread::entry(Thread* thread)
|
||||
{
|
||||
void* ret = NULL;
|
||||
// @todo: We only need this for CPU worker threads.
|
||||
#if !defined(_WIN64)
|
||||
if (true /*thread->isWorkerThread()*/) {
|
||||
if (thread->isWorkerThread()) {
|
||||
__try {
|
||||
ret = thread->main();
|
||||
}
|
||||
|
||||
@@ -131,6 +131,9 @@ public:
|
||||
//! Return true is this is the host thread.
|
||||
virtual bool isHostThread() const { return false; }
|
||||
|
||||
//! Return true if this is a worker thread.
|
||||
virtual bool isWorkerThread() const { return false; }
|
||||
|
||||
//! Get the current thread state.
|
||||
ThreadState state() const { return state_; }
|
||||
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user