Paul Gofman : ntdll/tests: Do not write to fs, gs when testing cleared segment regs on x64.

Alexandre Julliard julliard at winehq.org
Wed Jun 23 16:10:10 CDT 2021


Module: wine
Branch: master
Commit: 4e4847dd71a3c682356559a51705ccec93b2490e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4e4847dd71a3c682356559a51705ccec93b2490e

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Wed Jun 23 19:37:33 2021 +0300

ntdll/tests: Do not write to fs, gs when testing cleared segment regs on x64.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51152
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/tests/exception.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index 253b304d312..7e849fba1aa 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -2906,13 +2906,30 @@ static const struct exception
         0x31, 0xc0, /* xor %eax,%eax */
         0x8e, 0xc0, /* mov %eax,%es */
         0x8e, 0xd8, /* mov %eax,%ds */
+#if 0
+        /* It is observed that fs/gs base is reset
+           on some CPUs when setting the segment value
+           even to 0 (regardless of CPU spec
+           saying otherwise) and it is not currently
+           handled in Wine.
+           Disable this part to avoid crashing the test. */
         0x8e, 0xe0, /* mov %eax,%fs */
         0x8e, 0xe8, /* mov %eax,%gs */
+#else
+        0x90, 0x90, /* nop */
+        0x90, 0x90, /* nop */
+#endif
         0xfa,       /* cli */
         0x58,       /* pop %rax */
+#if 0
         0x8e, 0xe8, /* mov %eax,%gs */
         0x58,       /* pop %rax */
         0x8e, 0xe0, /* mov %eax,%fs */
+#else
+        0x58,       /* pop %rax */
+        0x90, 0x90, /* nop */
+        0x90, 0x90, /* nop */
+#endif
         0x58,       /* pop %rax */
         0x8e, 0xd8, /* mov %eax,%ds */
         0x58,       /* pop %rax */




More information about the wine-cvs mailing list