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

Allow for more fine tuned CPU feature/mode settings #1992

Open
Rot127 opened this issue Apr 12, 2023 · 3 comments
Open

Allow for more fine tuned CPU feature/mode settings #1992

Rot127 opened this issue Apr 12, 2023 · 3 comments
Milestone

Comments

@Rot127
Copy link
Collaborator

Rot127 commented Apr 12, 2023

Currently (almost) all features are enabled for each architecture. This leads to a little inaccurate disassembly. Especially when it comes to alias of instructions.

Example from ARM:

# Without ARM_FeatureRAS
0xaff31080	hint.w	#0x10
# WIth ARM_FeatureRAS
0xaff31080	esbge.w	#0x10

Since an architecture can have easily more than 100 features it needs another mechanism to toggle those.
Currently only a few CS_MODE_X flags can be passed.

@Rot127
Copy link
Collaborator Author

Rot127 commented Aug 17, 2024

The whole way to store options should be overthought again. Currently there is no clear distinction between options for modules and whole CS. CS_MODE_ for example gets set by the module. But in general is saved in the handle.

@Rot127 Rot127 added this to the v7.0 milestone Aug 17, 2024
@Rot127 Rot127 changed the title Allow for more fine tuned feature settings Allow for more fine tuned CPU feature/mode settings Aug 22, 2024
@Rot127
Copy link
Collaborator Author

Rot127 commented Aug 22, 2024

This would also allow to test instructions which are only used in certain modes independently. As well as instructions with changing asm text syntax.

It would also allow to add more MC test cases. Currently always the last generated file is written.

@wargio
Copy link
Contributor

wargio commented Aug 28, 2024

I think the most annoying part of the update is understanding which CPU feature is enabled or not.
LLVM uses Proc in the .td file to generate a list of CPUs which has features enabled/disabled.

Example:
From : https://github.com/llvm-mirror/llvm/blob/master/lib/Target/Mips/Mips.td#L230 and https://github.com/llvm-mirror/llvm/blob/master/lib/Target/Mips/Mips.td#L76
You can generate a table of features for each Proc, then you can convert into a reverse table to generate the correct configuration for https://github.com/capstone-engine/capstone/pull/2410/files#diff-b2b2f5b6be21623f5bfa0de90d0e496e176895a266ac013846baaa58784d27b2R57-R66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants