Skip to content
This repository was archived by the owner on Apr 6, 2025. It is now read-only.
This repository was archived by the owner on Apr 6, 2025. It is now read-only.

XED Encoder API #9

@Phantomical

Description

@Phantomical

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions