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

arm: Sign of immediate is unclear #2056

Open
akihikodaki opened this issue Jun 22, 2023 · 1 comment
Open

arm: Sign of immediate is unclear #2056

akihikodaki opened this issue Jun 22, 2023 · 1 comment

Comments

@akihikodaki
Copy link
Contributor

This issue was found during the discussion at: #771 (comment)

Some instructions interpret immediates as signed while the others interpret them as unsigned. However, the imm member of cs_arm_op is typed as signed, which causes two problems:

  • PC-relative addresses overflow when storing if the address is more than INT32_MAX as they are computed as unsigned.
  • The code reading the imm member of cs_arm_op may incorrectly think it is signed when it should be treated as unsigned.

It will be nice if we can change how to store and load immediate values in cs_arm_op depending on instructions.

@Rot127
Copy link
Collaborator

Rot127 commented Jun 22, 2023

Just as a note. LLVM saves immediate values in general as int64_t. We can think about doing just that. So we mimic LLVM as close as possible.

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