Brendan Shanks <bshanks(a)codeweavers.com> writes:
+static LONG CALLBACK umip_vectored_handler(EXCEPTION_POINTERS *ExceptionInfo) +{ + PEXCEPTION_RECORD rec = ExceptionInfo->ExceptionRecord; + trace("vectored exception handler %08x addr:%p\n", rec->ExceptionCode, rec->ExceptionAddress); + + ok (!(rec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && + rec->ExceptionInformation[0] == 0 && + rec->ExceptionInformation[1] == UINTPTR_MAX), + "vectored_handler caught fault for unemulated UMIP instruction, exiting\n"); + + ExitProcess(1); + + return EXCEPTION_CONTINUE_SEARCH; +} +#endif /* __x86_64__ || __i386__ */ + +START_TEST(umip) +{ + /* Test that sldt, str, sgdt, sidt, and smsw can be executed with + * all possible operand types (registers/memory of different widths). + * + * We mostly cannot test/predict the returned values, but on a UMIP-enabled + * system without emulation the instructions willl trigger a SIGSEGV. + * A non-first-chance vectored exception handler is added to catch the exception, + * fail the test, and exit the process if that happens. + */
This test should go with the others in exception.c, where you can reuse the infrastructure to handle exceptions etc. -- Alexandre Julliard julliard(a)winehq.org