On 05.02.2017 07:10, Andrew Wesie wrote:
This is a work-around so that Dr7 is initialized to a reasonable value. Before it was just uninitialized memory. The test will fail without the work-around, and shows a todo if Dr7 is zero.
Signed-off-by: Andrew Wesie awesie@gmail.com
dlls/ntdll/signal_x86_64.c | 1 + dlls/ntdll/tests/exception.c | 121 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+)
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c index f33fe4c..af16cfd 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c @@ -1692,6 +1692,7 @@ static void save_context( CONTEXT *context, const ucontext_t *sigcontext ) context->u.FltSave = *FPU_sig(sigcontext); context->MxCsr = context->u.FltSave.MxCsr; }
- context->Dr7 = 0;
}
Wouldn't it make more sense to add a proper implementation for all debug registers? We already have the signal_i386 code for an example how to do it, and other functions like NtGetContextThread also support querying the debug registers (even on x86_64).
Best regards, Sebastian
On Sun, Feb 5, 2017 at 12:31 AM, Sebastian Lackner sebastian@fds-team.de wrote:
Wouldn't it make more sense to add a proper implementation for all debug registers? We already have the signal_i386 code for an example how to do it, and other functions like NtGetContextThread also support querying the debug registers (even on x86_64).
I looked at NtGetContextThread and I was wary of adding a server call to save_context.
Looking at the i386 version, it seems that NtGetContextThread caches the debug registers so that save_context doesn't need to do a server call. I can add something similar for x86_64, if there isn't a reason not to.
-Andrew
On 05.02.2017 07:45, Andrew Wesie wrote:
On Sun, Feb 5, 2017 at 12:31 AM, Sebastian Lackner sebastian@fds-team.de wrote:
Wouldn't it make more sense to add a proper implementation for all debug registers? We already have the signal_i386 code for an example how to do it, and other functions like NtGetContextThread also support querying the debug registers (even on x86_64).
I looked at NtGetContextThread and I was wary of adding a server call to save_context.
Looking at the i386 version, it seems that NtGetContextThread caches the debug registers so that save_context doesn't need to do a server call. I can add something similar for x86_64, if there isn't a reason not to.
-Andrew
I think a version similar to how its done on i386 would be perfectly fine. The biggest problem is probably the limited amount of TEB space we have available, but it also shouldn't hurt to use fields after SpareBytes1. If you have any questions, feel free to ask!
Best regards, Sebastian