Page MenuHomePhabricator

[lldb] [Process] Introduce common helpers to split/recombine YMM data
ClosedPublic

Authored by mgorny on Thu, Jun 20, 9:46 AM.

Details

Summary

Introduce two common helpers to take care of splitting and recombining
YMM registers to/from XSAVE-like data. Since FreeBSD, Linux and NetBSD
all use XSAVE-like data structures but with potentially different field
layouts, the function takes two pointers -- to XMM register and to YMM
high bits, and copies the data from/to YMMReg type.

While at it, remove support for big endian. To mine and Pavel Labath's
combined knowledge, there is no such thing on x86. Furthermore,
assuming that the YMM register data would be swapped for big endian
seems to be a weird assumption.

// NB: I have no clue why FreeBSD code claims to belong in 'POSIX', and Linux does not.

Diff Detail

Repository
rL LLVM

Event Timeline

mgorny created this revision.Thu, Jun 20, 9:46 AM
labath accepted this revision.Fri, Jun 21, 12:47 AM

It's not much, but it definitely does help.

// NB: I have no clue why FreeBSD code claims to belong in 'POSIX', and Linux does not.

I think that somehow fell out of the fact that FreeBSD uses an in-process debugging plugin, while linux uses lldb-server.

lldb/source/Plugins/Process/Utility/RegisterContext_x86.h
357 ↗(On Diff #205842)

maybe call the last arg ymmh_bytes ?

This revision is now accepted and ready to land.Fri, Jun 21, 12:47 AM
mgorny marked 2 inline comments as done.Fri, Jun 21, 6:15 AM

It's not much, but it definitely does help.

// NB: I have no clue why FreeBSD code claims to belong in 'POSIX', and Linux does not.

I think that somehow fell out of the fact that FreeBSD uses an in-process debugging plugin, while linux uses lldb-server.

Ok, then I probably don't have to worry about porting NetBSD to reuse that stuff ;-).

lldb/source/Plugins/Process/Utility/RegisterContext_x86.h
357 ↗(On Diff #205842)

Makes sense.

This revision was automatically updated to reflect the committed changes.
mgorny marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptFri, Jun 21, 6:18 AM

It's not much, but it definitely does help.

// NB: I have no clue why FreeBSD code claims to belong in 'POSIX', and Linux does not.

I think that somehow fell out of the fact that FreeBSD uses an in-process debugging plugin, while linux uses lldb-server.

Ok, then I probably don't have to worry about porting NetBSD to reuse that stuff ;-).

No, but if you can figure out how to make Linux and NetBSD share more stuff, then that would be super-awesome. :)