GithubHelp home page GithubHelp logo

Comments (2)

gerph avatar gerph commented on May 28, 2024

I'm not convinced that aligning these makes sense; if Unicorn were brought in line with Capstone 5 then users of Unicorn that require Capstone 4 (because Capstone 5 was incompatible/had breakages/couldn't be upgraded for other reasons), who assumed that Unicorn and Capstone 4 had aligned registers would find that things broke with the upgrade of Unicorn.

Whilst it might be nice to have the two systems use the same value, since they have already diverged it is already clear that the behaviour of relying on two independent projects having the same constants was unreliable at best. The problem you mention is really showing the fact that you can't rely on the fact that the two projects happen to have used the same constant values to mean the same thing is a guaranteed behaviour. If it were a guaranteed behaviour, then the change in Capstone would have been a bug. Both the case that I suggest (a Unicorn user relying on the direct mapping to Capstone 4 constant values), and the case that you suggest (a Unicorn user relying on the direct mapping to Capstone 5 constant values) cannot both be true - and since Unicorn does not require that you use a specific version of Capstone, a program relying on such behaviour is not using the libraries properly.

And if the behaviour of Capstone is tied to that of LLVM then this means that Capstone's register mapping is subsequently at the whim of the LLVM developers and their definition of the register mappings. So if LLVM changed its mappings, Capstone would change, and thus force a major version increment to ensure binary compatibility, which then would mean that the Unicorn project would need to change its mappings to match the newly updated Capstone mappings.

What I'm trying to say is that by tying the constant values of each project together and assuming that you can pass Unicorn::UC_ARM64_REG_X20 where a Capstone register is expected is wrong. And trying to enforce that it always be true means that the version of LLVM that builds the Capstone register bindings must be kept in lockstep with the version of Unicorn if you want to use that version of Capstone. That is, Unicorn X.. will only work with Capstone X.. and nothing else if you rely on passing those values interchangeably. Which isn't the way I expect the libraries to be used. I expect that I can use Unicorn X with Capstone Y, so long as I convert between the types required.

Sorry, that might be a lot of words just to say "I don't think this can work".

from unicorn.

wtdcode avatar wtdcode commented on May 28, 2024

Closing this thanks to the excellent explanation from @gerph . I also had a few comments on it.

from unicorn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.