Support Signed Lifted IL Shift Amounts in Custom Architectures

Open
#6,090 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp

Research direction

Start by examining the existing Lifted IL arithmetic and logical shift operations and the custom-architecture lifting paths described in the issue. Determine whether signed shift amounts should use new operations or changed argument semantics, then document the chosen behavior and verify it for negative amounts and opposite-direction shifts.

Written by the indexing model from the issue text.

Description

Component: API Component: Architecture Core: LLIL Effort: Low Impact: Medium Lifting

What is the feature you'd like to have?
Support negative/signed shift amounts in arithmetic and logical shifts. At present, an IL arithmetic shift right with a shift amount of 0xFFFFFFFF on a 32-bit architecture results in an attempted shift of val >> 4294967295, resulting in a value filled with whatever the upper-most bit was. I would like to see either additional Lifted IL operations that accept a signed shift amount, or to have the existing Lifted IL operations interpret the shift amount argument as a signed value, with corresponding documented semantics.

Is your feature request related to a problem?
Hexagon provides arithmetic and logical shift operations for both left- and right- shifts that take a shift amount from a register. The architecture defines the semantics for a negative shift amount as a shift of the same type (arithmetic or logical) in the opposite direction. This is presently somewhat tricky to lift, and would introduce additional conditionals into the IL flow for every shift operation of this type.

Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Vector35/binaryninja-api

All issues in Vector35/binaryninja-api

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.