Signed-off-by: Paul Gofman gofmanp@gmail.com --- dlls/ntdll/tests/exception.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index b8bd186632..5d108bade1 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -1509,7 +1509,8 @@ static void test_thread_context(void) struct expected { DWORD Eax, Ebx, Ecx, Edx, Esi, Edi, Ebp, Esp, Eip, - SegCs, SegDs, SegEs, SegFs, SegGs, SegSs, EFlags, prev_frame; + SegCs, SegDs, SegEs, SegFs, SegGs, SegSs, EFlags, prev_frame, + x87_control, save_x87_control, new_x87_control; } expect; NTSTATUS (*func_ptr)( struct expected *res, void *func, void *arg1, void *arg2 ) = (void *)code_mem;
@@ -1542,10 +1543,23 @@ static void test_thread_context(void) 0x8f, 0x40, 0x3c, /* popl 0x3c(%eax) */ 0xff, 0x75, 0x00, /* pushl 0x0(%ebp) ; previous stack frame */ 0x8f, 0x40, 0x40, /* popl 0x40(%eax) */ + + 0x9b, 0xd9, 0x78, 0x48, /* fstcw 0x48(%eax) */ + 0x68, 0x7f, 0x04, 0x00, 0x00, /* pushl $0x47f */ + 0x8f, 0x40, 0x44, /* popl 0x44(%eax) */ + 0xd9, 0x68, 0x44, /* fldcw 0x44(%eax); */ + 0x8b, 0x00, /* mov (%eax),%eax */ 0xff, 0x75, 0x14, /* pushl 0x14(%ebp) */ 0xff, 0x75, 0x10, /* pushl 0x10(%ebp) */ 0xff, 0x55, 0x0c, /* call *0xc(%ebp) */ + + 0x50, /* pushl %eax */ + 0x8b, 0x45, 0x08, /* mov 0x8(%ebp),%eax */ + 0x9b, 0xd9, 0x78, 0x4c, /* fstcw 0x4c(%eax) */ + 0xd9, 0x68, 0x48, /* fldcw 0x48(%eax); */ + 0x58, /* popl %eax */ + 0xc9, /* leave */ 0xc3, /* ret */ }; @@ -1593,7 +1607,8 @@ static void test_thread_context(void)
memset( &context, 0xcc, sizeof(context) ); memset( &expect, 0xcc, sizeof(expect) ); - context.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS; + context.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT; + status = func_ptr( &expect, pNtGetContextThread, (void *)GetCurrentThread(), &context ); ok( status == STATUS_SUCCESS, "NtGetContextThread failed %08x\n", status ); trace( "expect: eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x ebp=%08x esp=%08x " @@ -1625,6 +1640,13 @@ static void test_thread_context(void) ok( context.SegFs == LOWORD(expect.SegFs), "wrong SegFs %08x/%08x\n", context.SegFs, expect.SegFs ); ok( context.SegGs == LOWORD(expect.SegGs), "wrong SegGs %08x/%08x\n", context.SegGs, expect.SegGs ); ok( context.SegSs == LOWORD(expect.SegSs), "wrong SegSs %08x/%08x\n", context.SegSs, expect.SegGs ); + + ok( LOWORD(context.FloatSave.ControlWord) == LOWORD(expect.x87_control), + "wrong x87 control word %#x/%#x.\n", context.FloatSave.ControlWord, expect.x87_control ); + todo_wine ok( LOWORD(expect.x87_control) == LOWORD(expect.new_x87_control), + "x87 control word changed in NtGetContextThread() %#x/%#x.\n", + LOWORD(expect.x87_control), LOWORD(expect.new_x87_control) ); + #undef COMPARE }