avx512 registers & fixes for getting & setting x64 context #290
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds getting & setting thread context for avx-512 registers for 64-bit windows target.
It also fixes wrong code for getting xmm & ymm registers - the 128-bit halves were swapped. And
GetXStateFeaturesMask
was used incorrectly - it should be used afterGetThreadContext
, not before.Theoretically 32-bit target also should support ymm & zmm registers, but I did not bother updating code for 32-bit codepaths.
I'm not completely sure about changes to
codeview.h
file - please check if that's fine. I'm not sure if it needs also zmm register enum values there in some form.And I hope it's ok to change
rdi_format.h
file with new zmm register enums - they are 32 zmm's up from 16 ymm's.Here's how the attached test program is running on avx-512 capable CPU:
a.c.txt
It is compiled with
clang-cl.exe -Zi a.c
All the zmmN & kN registers are now visible in
Registers
view too. I would say it probably soon will require some improvements - there are too many of registers. It would be nice if they could be grouped in SSE, AVX, AVX-512 & similar categories. Ideally it also should not show the ones that are not supported on cpu in the target.There is one disadvantage of doing
SetThreadContext
this way. It always sets all AVX and AVX-512 registers, even if user did not change any of them. That means context switches are now a bit more expensive, because OS needs to switch all the ymm and zmm registers. Usually OS does not do that, until first time you modify ymm or zmm register in a thread. Ideally debugger would store some mask inREGS_RegBlockX64
about which ymm/zmm register groups are modified and set only those.