Mercurial > hg > graal-jvmci-8
comparison src/os/windows/vm/os_windows.cpp @ 7696:fbbc2ea60c4d
fixed signal handler for long underflow on windows
author | Christian Haeubl <haeubl@ssw.jku.at> |
---|---|
date | Mon, 04 Feb 2013 17:29:13 +0100 |
parents | 3ac7d10a6572 |
children | 5fc51c1ecdeb |
comparison
equal
deleted
inserted
replaced
7695:320d6fd3dbf3 | 7696:fbbc2ea60c4d |
---|---|
2101 // handle exception caused by idiv; should only happen for -MinInt/-1 | 2101 // handle exception caused by idiv; should only happen for -MinInt/-1 |
2102 // (division by zero is handled explicitly) | 2102 // (division by zero is handled explicitly) |
2103 #ifdef _M_IA64 | 2103 #ifdef _M_IA64 |
2104 assert(0, "Fix Handle_IDiv_Exception"); | 2104 assert(0, "Fix Handle_IDiv_Exception"); |
2105 #elif _M_AMD64 | 2105 #elif _M_AMD64 |
2106 PCONTEXT ctx = exceptionInfo->ContextRecord; | 2106 #ifdef GRAAL |
2107 address pc = (address)ctx->Rip; | 2107 PCONTEXT ctx = exceptionInfo->ContextRecord; |
2108 #ifndef GRAAL | 2108 address pc = (address)ctx->Rip; |
2109 assert(pc[0] == 0xF7, "not an idiv opcode"); | 2109 assert(pc[0] == 0x48 && pc[1] == 0xF7 || pc[0] == 0xF7, "not an idiv opcode"); |
2110 assert((pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands"); | 2110 if (pc[0] == 0x48) { |
2111 assert(ctx->Rax == min_jint, "unexpected idiv exception"); | 2111 // set correct result values and continue after idiv instruction |
2112 #endif | 2112 ctx->Rip = (DWORD64)pc + 3; // REX idiv reg, reg is 3 bytes |
2113 // set correct result values and continue after idiv instruction | 2113 ctx->Rax = (DWORD64)min_jlong; // result |
2114 ctx->Rip = (DWORD)pc + 2; // idiv reg, reg is 2 bytes | 2114 } else { |
2115 ctx->Rax = (DWORD)min_jint; // result | 2115 ctx->Rip = (DWORD64)pc + 2; // idiv reg, reg is 2 bytes |
2116 ctx->Rdx = (DWORD)0; // remainder | 2116 ctx->Rax = (DWORD64)min_jint; // result |
2117 // Continue the execution | 2117 } |
2118 ctx->Rdx = (DWORD64)0; // remainder | |
2119 // Continue the execution | |
2120 #else | |
2121 PCONTEXT ctx = exceptionInfo->ContextRecord; | |
2122 address pc = (address)ctx->Rip; | |
2123 assert(pc[0] == 0xF7, "not an idiv opcode"); | |
2124 assert((pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands"); | |
2125 assert(ctx->Rax == min_jint, "unexpected idiv exception"); | |
2126 // set correct result values and continue after idiv instruction | |
2127 ctx->Rip = (DWORD)pc + 2; // idiv reg, reg is 2 bytes | |
2128 ctx->Rax = (DWORD)min_jint; // result | |
2129 ctx->Rdx = (DWORD)0; // remainder | |
2130 // Continue the execution | |
2131 #endif // GRAAL | |
2118 #else | 2132 #else |
2119 PCONTEXT ctx = exceptionInfo->ContextRecord; | 2133 PCONTEXT ctx = exceptionInfo->ContextRecord; |
2120 address pc = (address)ctx->Eip; | 2134 address pc = (address)ctx->Eip; |
2121 assert(pc[0] == 0xF7, "not an idiv opcode"); | 2135 assert(pc[0] == 0xF7, "not an idiv opcode"); |
2122 assert((pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands"); | 2136 assert((pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands"); |