iximeow / yaxpeax-x86

x86 decoders for the yaxpeax project
BSD Zero Clause License
132 stars 23 forks source link

Exposing the relations between register names #30

Open meithecatte opened 1 year ago

meithecatte commented 1 year ago

I find myself writing some ugly code to answer questions like "which 64-bit GPR is ch a part of? which bits?".

I would expect yaxpeax to provide APIs on RegSpec for this, though I understand if this is something you want to model in yaxpeax_arch, with the API design questions this involves.

iximeow commented 1 year ago

agreed on all counts! yaxpeax_core has a pretty unsatisfactory interface for this that i'd never gotten happy enough with to move over to arch, but i definitely agree that "this register selects the u64 you're using to represent rcx" or similar should be something this crate can answer. reading between the lines, that's kind of related to what @i509VCB was getting at over here (agh goodness that's an old issue)

so, that said, i think something more specifically suited to x86 is a great excuse to think about what a good interface would feel like.

things off the top of my head:

and of course at the minimum, "what is the largest alias?" and "what is the smallest larger alias?" should be const fn.