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

[WIP] update to capstone v4 #4 #5

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

nganhkhoa
Copy link

@nganhkhoa nganhkhoa commented May 2, 2020

  • arm
  • arm64
  • evm
  • m68k
  • m680x
  • mips
  • ppc
  • sparc
  • systemz
  • tms320c64x
  • x86
  • xcore.h

I also remove hardcoded number and replace with macros from c2hs.

Need tests!!!

@nganhkhoa nganhkhoa changed the title [WIP] update to capstone v4 [WIP] update to capstone v4 #4 May 2, 2020
nganhkhoa added 3 commits June 1, 2020 11:44
The bootstraped code cannot compile, add modules to hapstone.cabal
Fix compilation failures
@nganhkhoa
Copy link
Author

Apparently, the code builds fine with stack. I still miss some #define though. I'll be writing tests for the new archs. Hope it works.

@nganhkhoa
Copy link
Author

I should get back to this around this time. There seems to be no big update to capstone over the last year. The latest version is 4.0.2 and released on May 2020. A few fixes with the current release will be compatible then tests are to be added.

@nganhkhoa
Copy link
Author

I'll be porting the binding test in https://github.com/aquynh/capstone/tree/v4/bindings/python into Example folder.

Then I generate the test cases in test/ by comparing the mnemonic and opcode string output.

@nganhkhoa
Copy link
Author

Yeah, just discovered an issue with c2hs. Apparently we can use {#get struct->member#} p to make a Bool, expanded into toBool `fmap` peekByteOff p <offset> :: IO CInt. And this might not work well in some cases.

So I have to go back to all the Bool and change into toBool <$> (peekByteOff p {#offset struct->member#} :: IO Word8)

I don't know if this is intended behavior of c2hs to assume a Bool as an CInt rather then Int8. But I got issue when disassemble all the CsArmOp and found out all of them are subtracted. Same thing happens with CsArm writeback but in edge cases only. I doubted the Boolean decoding.

@nganhkhoa
Copy link
Author

Just found out that when can replace if then () else pure (). Rewriting TestArm.

Update soon for all other tests.

@XVilka
Copy link

XVilka commented Jul 5, 2023

Capstone 5.0 is about to be released, it's better to target it instead:

There is also a huge project to automate updates for different architectures to stay relevant with minimum effort, but it will bring some API differences: capstone-engine/capstone#2015

Please let us know if you have any feedback about the current state or the auto-sync project.

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

Successfully merging this pull request may close these issues.

2 participants