Comments (2)
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.
Closing this thanks to the excellent explanation from @gerph . I also had a few comments on it.
from unicorn.
Related Issues (20)
- v2.1.0 Plan HOT 9
- Question and maybe even suggestion : ) HOT 3
- unicorn for cygwin HOT 1
- RISC-V64 incorrectly returns error when calling `emu_start` with `count` = 1 at end of page
- Memory hooks cause incorrect emulation of the carry flag for the SAR instrution on x86_64 HOT 2
- ctl_set_cpu_model issues HOT 2
- Difference between memory and block hooks HOT 5
- mips 3 issues HOT 2
- When running x86 simulation in unrestricted mode, there's an EFLAGS error upon exiting HOT 3
- distutils deprecation
- UC_HOOK_INTR not observed HOT 1
- Changing x86 32 bit execution to x86 64 bit and vice versa HOT 3
- glib_compat breaks Qt Widgets with glib backend HOT 11
- page_collection_lock causing a crash HOT 3
- Does memory need to be mapped aligned to page boundaries? HOT 1
- Ignoring a Branchs/Handling Invalid Memory Access Handling Gracefully HOT 4
- Setting RIP inside callback doesn't change execution flow HOT 2
- Paging doesn't work on x86, is that by design? HOT 4
- ARM32 Cortex A9 MRRC instruction UC_ERR_INSN_INVALID HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unicorn.