comparison src/os/windows/vm/os_windows.cpp @ 12356:359f7e70ae7f

Reduce HotSpot diff and fix previous merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 11 Oct 2013 15:41:33 +0200
parents cefad50507d8
children d8041d695d19
comparison
equal deleted inserted replaced
12355:cefad50507d8 12356:359f7e70ae7f
2213 // handle exception caused by idiv; should only happen for -MinInt/-1 2213 // handle exception caused by idiv; should only happen for -MinInt/-1
2214 // (division by zero is handled explicitly) 2214 // (division by zero is handled explicitly)
2215 #ifdef _M_IA64 2215 #ifdef _M_IA64
2216 assert(0, "Fix Handle_IDiv_Exception"); 2216 assert(0, "Fix Handle_IDiv_Exception");
2217 #elif _M_AMD64 2217 #elif _M_AMD64
2218 #ifdef GRAAL 2218 PCONTEXT ctx = exceptionInfo->ContextRecord;
2219 PCONTEXT ctx = exceptionInfo->ContextRecord; 2219 address pc = (address)ctx->Rip;
2220 address pc = (address)ctx->Rip; 2220 #ifdef GRAAL
2221 assert(pc[0] >= Assembler::REX && pc[0] <= Assembler::REX_WRXB && pc[1] == 0xF7 || pc[0] == 0xF7, "not an idiv opcode"); 2221 assert(pc[0] >= Assembler::REX && pc[0] <= Assembler::REX_WRXB && pc[1] == 0xF7 || pc[0] == 0xF7, "not an idiv opcode");
2222 if (pc[0] == 0xF7) { 2222 if (pc[0] == 0xF7) {
2223 // set correct result values and continue after idiv instruction
2224 ctx->Rip = (DWORD64)pc + 2; // idiv reg, reg is 2 bytes
2225 } else {
2226 ctx->Rip = (DWORD64)pc + 3; // REX idiv reg, reg is 3 bytes
2227 }
2228 // do not set ctx->Rax as it already contains the correct value (either 32 or 64 bit, depending on the operation)
2229 // this is the case because the exception only happens for -MinValue/-1 and -MinValue is always in rax because of the
2230 // idiv opcode (0xF7)
2231 ctx->Rdx = (DWORD64)0; // remainder
2232 // Continue the execution
2233 #else
2234 PCONTEXT ctx = exceptionInfo->ContextRecord;
2235 address pc = (address)ctx->Rip;
2236 assert(pc[0] == 0xF7, "not an idiv opcode");
2237 assert((pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands");
2238 assert(ctx->Rax == min_jint, "unexpected idiv exception");
2239 // set correct result values and continue after idiv instruction 2223 // set correct result values and continue after idiv instruction
2240 ctx->Rip = (DWORD)pc + 2; // idiv reg, reg is 2 bytes 2224 ctx->Rip = (DWORD64)pc + 2; // idiv reg, reg is 2 bytes
2241 ctx->Rax = (DWORD)min_jint; // result 2225 } else {
2242 ctx->Rdx = (DWORD)0; // remainder 2226 ctx->Rip = (DWORD64)pc + 3; // REX idiv reg, reg is 3 bytes
2243 // Continue the execution 2227 }
2244 #endif // GRAAL 2228 // do not set ctx->Rax as it already contains the correct value (either 32 or 64 bit, depending on the operation)
2229 // this is the case because the exception only happens for -MinValue/-1 and -MinValue is always in rax because of the
2230 // idiv opcode (0xF7)
2231 #else
2232 assert(pc[0] == 0xF7, "not an idiv opcode");
2233 assert((pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands");
2234 assert(ctx->Rax == min_jint, "unexpected idiv exception");
2235 // set correct result values and continue after idiv instruction
2236 ctx->Rip = (DWORD)pc + 2; // idiv reg, reg is 2 bytes
2237 ctx->Rax = (DWORD)min_jint; // result
2238 #endif // GRAAL
2239 ctx->Rdx = (DWORD)0; // remainder
2240 // Continue the execution
2245 #else 2241 #else
2246 PCONTEXT ctx = exceptionInfo->ContextRecord; 2242 PCONTEXT ctx = exceptionInfo->ContextRecord;
2247 address pc = (address)ctx->Eip; 2243 address pc = (address)ctx->Eip;
2248 assert(pc[0] == 0xF7, "not an idiv opcode"); 2244 assert(pc[0] == 0xF7, "not an idiv opcode");
2249 assert((pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands"); 2245 assert((pc[1] & ~0x7) == 0xF8, "cannot handle non-register operands");