Skip to content

Conversation

jsturtevant
Copy link
Contributor

@jsturtevant jsturtevant commented Aug 22, 2025

This pull request adds support for reading and writing XMM and MXCSR registers in the GDB debug interface for all supported hypervisors (KVM, MSHV, and WHVP). It introduces new fields to the register structures to hold these values and implements the necessary logic to fetch and store them using each hypervisor's API.

Register structure updates:

  • Added xmm: [u128; 16] and mxcsr: u32 fields to the X86_64Regs struct to store XMM registers and MXCSR control state.

Todo:

  • implement set registers
  • Test on all the platforms.
    • kvm
    • mshv
    • hyperv

@jsturtevant jsturtevant added the kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. label Aug 22, 2025
Copy link
Contributor

@dblnz dblnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving the debugging experience. I left some small comments here and there.


// note kvm set_fpu doesn't actually set or read the mxcsr value
// https://elixir.bootlin.com/linux/v6.16/source/arch/x86/kvm/x86.c#L12229
self.vcpu_fd.set_fpu(&fpu)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How could we change the code to set/read the mxcsr value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using xsave, probably should open a separate PR to do that. for this particular spot

@jsturtevant jsturtevant force-pushed the add-additional-registers branch from cf6b67f to 66fe8b0 Compare September 13, 2025 00:10
Signed-off-by: James Sturtevant <[email protected]>
Signed-off-by: James Sturtevant <[email protected]>
Signed-off-by: James Sturtevant <[email protected]>
Signed-off-by: James Sturtevant <[email protected]>
@jsturtevant jsturtevant force-pushed the add-additional-registers branch from 66fe8b0 to 56a2912 Compare September 18, 2025 23:37
@jsturtevant jsturtevant force-pushed the add-additional-registers branch from 56a2912 to 3494b3e Compare September 18, 2025 23:56
Signed-off-by: James Sturtevant <[email protected]>
Signed-off-by: James Sturtevant <[email protected]>
@jsturtevant
Copy link
Contributor Author

I've updated to gdb related tests to work on Windows. This does require it to be installed on the runner vm's which is in progress. Will mark ready for review once that is complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement For PRs adding features, improving functionality, docs, tests, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants