From 3bc55f9568400301f5693f7f509a8e01ec447849 Mon Sep 17 00:00:00 2001 From: Luke Nelson Date: Thu, 15 Sep 2016 19:04:18 -0700 Subject: [PATCH 1/4] Relax transformers constraint for haskell bindings for GHC 8 --- bindings/haskell/unicorn.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/haskell/unicorn.cabal b/bindings/haskell/unicorn.cabal index 77af442e..027e09d2 100644 --- a/bindings/haskell/unicorn.cabal +++ b/bindings/haskell/unicorn.cabal @@ -31,7 +31,7 @@ library other-modules: Unicorn.Internal.Util build-depends: base >=4 && <5, bytestring >= 0.9.1, - transformers <= 0.5, + transformers < 0.6, either >= 4.4 hs-source-dirs: src c-sources: src/cbits/unicorn_wrapper.c From fce82b9532df559b148bae8a5ca86c247ddb7dbc Mon Sep 17 00:00:00 2001 From: esanfelix Date: Tue, 20 Sep 2016 10:15:58 +0200 Subject: [PATCH 2/4] Fixed ARM sample to properly run THUMB code #638 --- samples/sample_arm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/sample_arm.c b/samples/sample_arm.c index 2c69ce6a..fc3570ec 100644 --- a/samples/sample_arm.c +++ b/samples/sample_arm.c @@ -135,7 +135,8 @@ static void test_thumb(void) // emulate machine code in infinite time (last param = 0), or when // finishing all the code. - err = uc_emu_start(uc, ADDRESS, ADDRESS + sizeof(THUMB_CODE) -1, 0, 0); + // Note we start at ADDRESS | 1 to indicate THUMB mode. + err = uc_emu_start(uc, ADDRESS | 1, ADDRESS + sizeof(THUMB_CODE) -1, 0, 0); if (err) { printf("Failed on uc_emu_start() with error returned: %u\n", err); } From 7d99b598f1603a862f507d7fb43d39ec1723d461 Mon Sep 17 00:00:00 2001 From: esanfelix Date: Tue, 20 Sep 2016 10:29:21 +0200 Subject: [PATCH 3/4] Fix #638 for python sample too --- bindings/python/sample_arm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bindings/python/sample_arm.py b/bindings/python/sample_arm.py index a8491d19..e910defc 100755 --- a/bindings/python/sample_arm.py +++ b/bindings/python/sample_arm.py @@ -85,7 +85,8 @@ def test_thumb(): mu.hook_add(UC_HOOK_CODE, hook_code) # emulate machine code in infinite time - mu.emu_start(ADDRESS, ADDRESS + len(THUMB_CODE)) + # Note we start at ADDRESS | 1 to indicate THUMB mode. + mu.emu_start(ADDRESS | 1, ADDRESS + len(THUMB_CODE)) # now print out some registers print(">>> Emulation done. Below is the CPU context") From 95e8dc0fb845bfe0812fe855a4064a05dc74ac1d Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Tue, 20 Sep 2016 20:16:29 +0800 Subject: [PATCH 4/4] ruby & java: fix address of Thumb sample --- bindings/java/samples/Sample_arm.java | 2 +- bindings/ruby/sample_arm.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/java/samples/Sample_arm.java b/bindings/java/samples/Sample_arm.java index 06a049d0..b0e3cbb3 100644 --- a/bindings/java/samples/Sample_arm.java +++ b/bindings/java/samples/Sample_arm.java @@ -109,7 +109,7 @@ public class Sample_arm { // emulate machine code in infinite time (last param = 0), or when // finishing all the code. - u.emu_start(ADDRESS, ADDRESS + THUMB_CODE.length, 0, 0); + u.emu_start(ADDRESS | 1, ADDRESS + THUMB_CODE.length, 0, 0); // now print out some registers System.out.print(">>> Emulation done. Below is the CPU context\n"); diff --git a/bindings/ruby/sample_arm.rb b/bindings/ruby/sample_arm.rb index dd0e4a06..b948b617 100644 --- a/bindings/ruby/sample_arm.rb +++ b/bindings/ruby/sample_arm.rb @@ -87,7 +87,7 @@ def test_thumb() mu.hook_add(UC_HOOK_CODE, $hook_code) # emulate machine code in infinite time - mu.emu_start(ADDRESS, ADDRESS + THUMB_CODE.bytesize) + mu.emu_start(ADDRESS | 1, ADDRESS + THUMB_CODE.bytesize) # now print out some registers puts(">>> Emulation done. Below is the CPU context")