ntdll: Fix exception information for SSE floating point faults.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-08-20 11:18:36 +02:00
parent 17ba916c56
commit 8a8889340f
3 changed files with 18 additions and 12 deletions

View File

@ -1332,8 +1332,11 @@ static DWORD simd_fault_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_R
"exception code: %#x, should be %#x\n",
rec->ExceptionCode, STATUS_FLOAT_MULTIPLE_TRAPS);
ok( rec->NumberParameters == is_wow64 ? 2 : 1, "# of params: %i\n", rec->NumberParameters);
if (rec->NumberParameters >= 1)
ok( rec->ExceptionInformation[0] == 0, "param #1: %lx, should be 0\n", rec->ExceptionInformation[0]);
ok( rec->ExceptionInformation[0] == 0, "param #1: %lx, should be 0\n", rec->ExceptionInformation[0]);
if (rec->NumberParameters == 2)
ok( rec->ExceptionInformation[1] == ((XSAVE_FORMAT *)context->ExtendedRegisters)->MxCsr,
"param #1: %lx / %x\n", rec->ExceptionInformation[1],
((XSAVE_FORMAT *)context->ExtendedRegisters)->MxCsr);
}
context->Eip += 3; /* skip divps */
}
@ -3413,14 +3416,10 @@ static DWORD WINAPI simd_fault_handler( EXCEPTION_RECORD *rec, ULONG64 frame,
ULONG expect = *stage == 2 ? EXCEPTION_FLT_DIVIDE_BY_ZERO : EXCEPTION_FLT_INVALID_OPERATION;
ok( rec->ExceptionCode == expect, "exception code: %#x, should be %#x\n",
rec->ExceptionCode, expect );
todo_wine
ok( rec->NumberParameters == 2, "# of params: %i, should be 2\n", rec->NumberParameters);
if (rec->NumberParameters == 2)
{
/* no idea what these mean */
ok( rec->ExceptionInformation[0] == 0, "param #0: %lx\n", rec->ExceptionInformation[0]);
ok( rec->ExceptionInformation[1] != 0, "param #1: %lx\n", rec->ExceptionInformation[1]);
}
ok( rec->ExceptionInformation[0] == 0, "param #0: %lx\n", rec->ExceptionInformation[0]);
ok( rec->ExceptionInformation[1] == context->MxCsr, "param #1: %lx / %lx\n",
rec->ExceptionInformation[1], context->MxCsr);
}
context->Rip += 3; /* skip divps */
}

View File

@ -1956,9 +1956,8 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext )
siginfo->si_code);
rec.ExceptionCode = STATUS_FLOAT_MULTIPLE_TRAPS;
rec.NumberParameters = 1;
/* no idea what meaning is actually behind this but that's what native does */
rec.ExceptionInformation[0] = 0;
rec.ExceptionInformation[rec.NumberParameters++] = 0;
if (is_wow64) rec.ExceptionInformation[rec.NumberParameters++] = ((XSAVE_FORMAT *)xcontext.c.ExtendedRegisters)->MxCsr;
break;
default:
WINE_ERR( "Got unexpected trap %d\n", TRAP_sig(ucontext) );

View File

@ -2664,6 +2664,7 @@ static void trap_handler( int signal, siginfo_t *siginfo, void *sigcontext )
static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext )
{
EXCEPTION_RECORD rec = { 0 };
ucontext_t *ucontext = sigcontext;
switch (siginfo->si_code)
{
@ -2693,6 +2694,13 @@ static void fpe_handler( int signal, siginfo_t *siginfo, void *sigcontext )
rec.ExceptionCode = EXCEPTION_FLT_INVALID_OPERATION;
break;
}
if (TRAP_sig(ucontext) == TRAP_x86_CACHEFLT)
{
rec.NumberParameters = 2;
rec.ExceptionInformation[0] = 0;
rec.ExceptionInformation[1] = FPU_sig(ucontext) ? FPU_sig(ucontext)->MxCsr : 0;
}
setup_exception( sigcontext, &rec );
}