Jinoh Kang (@iamahuman) commented about dlls/ntdll/tests/exception.c:
0x48, 0x8b, 0x4c, 0x24, 0x08, /* mov rcx, [rsp+8*1]; context */0x48, 0x8b, 0x54, 0x24, 0x10, /* mov rdx, [rsp+8*2]; arg2 */0x48, 0x83, 0xec, 0x70, /* sub rsp, 0x70; change stack *//* setup context to return to label 1 */0x48, 0x8d, 0x05, 0x1b, 0x00, 0x00, 0x00, /* lea rax, [rel 1] (0x1b) */0x48, 0x89, 0x81, 0xf8, 0x00, 0x00, 0x00, /* mov [rcx + 0xf8 (context.Rip)], rax *//* trash EFLAGS */0x9c, /* pushfq */0x58, /* pop rax */0x48, 0x0d, 0x00, 0x45, 0x00, 0x00, /* or rax, 0x0100 + 0x4400; set trap flag so it's cleared.FIXME: also clearing Direction Flag and Nested Task as those break Wine */0x48, 0xf7, 0xd0, /* not rax */0x50, /* push rax */
Avoid changing unrelated flags. Reserved flag bits may obtain a meaning in the future and break tests.
```suggestion:-3+0 0x48, 0x81, 0x34, 0x24, 0xd5, 0x08, /* xorq $0x8d5,(%rsp) */ 0x00, 0x00, ```
Use xorq (QWORD PTR) instead of xorw (WORD PTR) to keep it straightforward and avoid potential store-to-load forwarding issues.