Skip to content
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

Exposing the relations between register names #30

Open
meithecatte opened this issue Feb 15, 2023 · 1 comment
Open

Exposing the relations between register names #30

meithecatte opened this issue Feb 15, 2023 · 1 comment

Comments

@meithecatte
Copy link

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
Copy link
Owner

iximeow commented Mar 5, 2023

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:

  • "what is the largest alias of this register?" (ch -> rcx)
  • "what is the smallest larger alias of this register?" (ch -> cx, cx -> ecx, ecx -> rcx)
  • "what registers are aliased by the largest alias of this register?" (ch -> {rcx, ecx, cx, cl}, maybe include ch in the list idk)
  • "what registers are aliased by the smallest larger alias of this register?" (ch -> {cx, cl}, maybe include ch in the list idk)
  • bonus: "where is this register, in that other register?" (ch -> (rcx, 8), cl -> (rcx, 0))

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

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

No branches or pull requests

2 participants