JitArm64: Implement EXCEPTION_FPU_UNAVAILABLE support.

Seems like this flag was missed.
This patch was mostly done by HdkR.
This commit is contained in:
degasus 2015-07-06 23:40:20 +02:00
parent af854dfa00
commit effb626bef
1 changed files with 23 additions and 0 deletions

View File

@ -303,6 +303,7 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitB
}
js.isLastInstruction = false;
js.firstFPInstructionFound = false;
js.blockStart = em_address;
js.fifoBytesThisBlock = 0;
js.downcountAmount = 0;
@ -389,6 +390,28 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitB
if (!ops[i].skip)
{
if ((opinfo->flags & FL_USE_FPU) && !js.firstFPInstructionFound)
{
//This instruction uses FPU - needs to add FP exception bailout
ARM64Reg WA = gpr.GetReg();
LDR(INDEX_UNSIGNED, WA, X29, PPCSTATE_OFF(msr));
FixupBranch b1 = TBNZ(WA, 13); // Test FP enabled bit
gpr.Flush(FLUSH_MAINTAIN_STATE);
fpr.Flush(FLUSH_MAINTAIN_STATE);
LDR(INDEX_UNSIGNED, WA, X29, PPCSTATE_OFF(Exceptions));
ORR(WA, WA, 26, 0); // EXCEPTION_FPU_UNAVAILABLE
STR(INDEX_UNSIGNED, WA, X29, PPCSTATE_OFF(Exceptions));
MOVI2R(WA, js.compilerPC);
WriteExceptionExit(WA);
SetJumpTarget(b1);
js.firstFPInstructionFound = true;
}
if (jo.memcheck && (opinfo->flags & FL_USE_FPU))
{
// Don't do this yet