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

XED Encoder API #9

Open
Phantomical opened this issue Feb 24, 2024 · 1 comment
Open

XED Encoder API #9

Phantomical opened this issue Feb 24, 2024 · 1 comment

Comments

@Phantomical
Copy link
Member

Phantomical commented Feb 24, 2024

We've got decent coverage of the decoder API but very little of the encoder. We need to do that. There should be decent coverage of the XED enums so this should mostly be just binding the various xed_encoder_request_set_xxx methods.

As far as I can tell the general way that encoding works in XED is as follows:

  • You create an empty xed_encoder_request_t (which is actually a xed_decoded_inst_t)
  • You set a bunch of options on it
  • You call xed_encode to encode the instruction

Some extra notes:

  • We can't use DecodedInst as-is because a bunch of the accessors panic if they get an invalid XED enum value. We either need to adjust how it works, or define a new type to use instead.
  • xed_operand_values_t is also a xed_decoded_inst_t. I'm not sure if a pointer gets stored in the instruction and thus there should be lifetimes involved.
  • There's also xed_encode_nop which doesn't quite fit in but might be ok to have as a free-floating function.

I suspect a InstructionBuilder type thing might actually be a good fit here. I haven't really spent any time thinking about what it would look like though.

@Phantomical
Copy link
Member Author

@flier I'm probably not gonna touch this one for a while so if you want an issue to try out this is probably a good one :)

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

1 participant