capstone icon indicating copy to clipboard operation
capstone copied to clipboard

New cs_reg_is_subreg API

Open stevielavern opened this issue 4 years ago • 4 comments

This adds a new public API in order to check if a register is a sub-register of another one: bool CAPSTONE_API cs_reg_is_subreg(csh ud, unsigned int reg_a, unsigned int reg_b)

For instance, cs_reg_is_subreg(csh, X86_REG_EAX, X86_REG_AH) will return true.

I had to add new fields to cs_struct in order to convert between public & private registers. This is needed especially for x86 where Capstone's public register enum doesn't match LLVM's one anymore (on Capstone next branch). An existing function does the conversion between public and private register IDs via a table, so I added the reverse table and function.

stevielavern avatar Jul 17 '20 15:07 stevielavern

Can you please create a new PR on libcapstone?

pranith avatar Mar 04 '21 07:03 pranith

@pranith Is libcapstone an unofficial fork? I submitted this PR to the official repo hoping that I won't have to maintain my own fork, and still get upstream patches. I don't think submitting it to yet another unofficial fork isn't going to help much. But feel free to clone this PR to your repo and mention this one.

stevielavern avatar Mar 12 '21 14:03 stevielavern

Any reason not to merge this despite the conflicts?

trufae avatar Oct 12 '22 10:10 trufae

I think this API is not essential.

On Wed, Oct 12, 2022, 18:10 pancake @.***> wrote:

Any reason not to merge this despite the conflicts?

— Reply to this email directly, view it on GitHub https://github.com/capstone-engine/capstone/pull/1665#issuecomment-1275922232, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNQNYDM646XDWVO7L44QVLWC2FAXANCNFSM4O6OUTGQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

aquynh avatar Oct 12 '22 10:10 aquynh

Thank you for the PR! I closed it because it is out of date. With the new auto-sync update for v6 we made many changes to some main architectures and will do also to others. This also changed the requirements we have now for new PRs.

If you still want to merge the changes, please rebase your fix onto the newest next branch and open a new PR.

Rot127 avatar Mar 20 '24 09:03 Rot127