Skip to content

Overhaul Register Capture - #1398

Draft
Aidan63 wants to merge 6 commits into
HaxeFoundation:masterfrom
Aidan63:overhaul-reg-capture
Draft

Overhaul Register Capture#1398
Aidan63 wants to merge 6 commits into
HaxeFoundation:masterfrom
Aidan63:overhaul-reg-capture

Conversation

@Aidan63

@Aidan63 Aidan63 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

I noticed some inconsistencies in terms of how registers are captured and what is captured, so this is an attempt to unify them.

  • Windows will always use RtlCaptureContext where as previously only 64bit x86 would use it. I have not tested the Arm64 path as I don't have access to an Arm Windows device, maybe there's a VM image somewhere.
  • All Windows targets will now capture the floating point registers, previously only 64bit x86 would do this. This is possible due to always using the RtlCaptureContext function which gives us access to the FXSAVE structure and NEON registers.
  • The _fxsave intrinsic is used for non Windows x86 to capture the floating point registers, previously the floating point registers were never captured.
  • All general purpose x86 registers are captured, previously the RegisterCapture::Capture function was used which contained four arguments to try and make sure the compiler couldn't pass arguments into functions as registers.
  • Where possible we capture the stack pointer and use that as the "bottom of the stack" instead of getting the address of a local variable.

Windows is still the only platform in which the Arm NEON registers are captured, I haven't found a nice way like _fxsave to capture all the extended state for Arm.

One issue is that 32bit x86 Windows seems to consistently crash in release mode, if I compile in debug mode it seems to run fine...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant