-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[x86] Expose segment base MSRs #52
Comments
If you take a peek at the current x86 arch defn, you'll find that it reports the following <target version="1.0">
<architecture>i386:x86-64</architecture>
<feature name="org.gnu.gdb.i386.sse"></feature>
</target> You can use the in-tree <target version="1.0">
<architecture>i386:x86-64</architecture>
<feature name="org.gnu.gdb.i386.sse"></feature>
<feature name="org.gnu.gdb.i386.segments"></feature>
</target> You'll need to define a custom struct X86_64_SegmentsRegs {
fs_base: u64,
gs_base: u64,
}
// and then package it up alongside the existing register defn
struct X86_64_SSE_SegmentsRegs {
core: gdbstub_arch::x86::reg::X86_64CoreRegs,
segments: X86_64_SegmentsRegs
} These are all public traits, and can be implemented by types outside of the main Now, while the above solution is all well and good, it does touch upon a larger and long-standing issue in I bring this up not as a call-to-action, but moreso as a reminder to my future self that I really need to stop kicking this issue down the road, and actually fixing this. After all, at the time of writing, there are 8 different x86 feature sets that can all be (theoretically) mixed and matched: https://sourceware.org/gdb/onlinedocs/gdb/i386-Features.html#i386-Features. Handling all combinations of features would require 8! == 40320 impls, which isn't at all sustainable! |
The
IA32_FS_BASE
,IA32_GS_BASE
MSRs are commonly used for thread-local storage (e.g., FS on Linux, GS on Windows), so it would be useful to support reporting them back to GDB in some cases.GDB exposes them as the
fs_base
andgs_base
virtual registers (https://github.com/bminor/binutils-gdb/blob/master/gdb/features/i386/64bit-segments.xml).The text was updated successfully, but these errors were encountered: