Commit Graph

150 Commits

Author SHA1 Message Date
Nguyen Anh Quynh
7665310daa samples: add -lrt for clock_gettime(), as suggested by Stephen 2016-12-19 23:50:21 +08:00
Chris Eagle
e46545f722 remove glib dependency by provide compatible replacements 2016-12-18 14:56:58 -08:00
Nguyen Anh Quynh
33813a0781 samples: fix Makefile for Mingw 2016-11-19 23:40:38 +08:00
Nguyen Anh Quynh
c4ddf4e36b fix samples/Makefile 2016-11-19 17:29:51 +08:00
Nguyen Anh Quynh
4a03f6021f fix merge conflict 2016-11-19 17:29:06 +08:00
Nguyen Anh Quynh
ab9bae4f3e revert the change on verbose option for Makefile 2016-11-19 17:20:05 +08:00
Stephen
75d90aff52 Make cleanup (#666)
* make cleanup

* Update .travis.yml
Update eflags_nosync.c
Update sigill2.c
Update ro_mem_test.c
Update ro_mem_test.c
Update nr_mem_test.c
Update mem_fuzz.c
Update mem_double_unmap.c
Update emu_stop_in_hook_overrun.c
Update eflags_nosync.c
remove unused
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update mem_64_c.c
Update mem_64_c.c
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update .travis.yml
try android ndk build
Update unicorn.py
Update unicorn.py
Update Makefile
Update unicorn.py
Update unicorn.py
remove an untrue comment

if a dll/so/dylib gets loaded at runtime is dependent on many different factors, primarily the LD/DYLD paths. Those do not always include the current working directory
Update Makefile
Update .appveyor.yml
Update .travis.yml
Update Makefile
Update .appveyor.yml
Fix bad sample

* Update Makefile

* Update Makefile

* Update install-cmocka-linux.sh

* remove verbose option from tar

* add upgrade to pacman for cmake

* pacman double update, needed to get new packages

* enable cmocka unit testing

* rejigger commands to fail on any step

should get fails in msys builds for cmocka

* fix quote

* make cmocka in cygwin only

* add msys cache
2016-11-19 17:17:48 +08:00
Stephen
9f0cdc4be9 Update .travis.yml
Update eflags_nosync.c
Update sigill2.c
Update ro_mem_test.c
Update ro_mem_test.c
Update nr_mem_test.c
Update mem_fuzz.c
Update mem_double_unmap.c
Update emu_stop_in_hook_overrun.c
Update eflags_nosync.c
remove unused
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update mem_64_c.c
Update mem_64_c.c
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update Makefile
Update .travis.yml
try android ndk build
Update unicorn.py
Update unicorn.py
Update Makefile
Update unicorn.py
Update unicorn.py
remove an untrue comment

if a dll/so/dylib gets loaded at runtime is dependent on many different factors, primarily the LD/DYLD paths. Those do not always include the current working directory
Update Makefile
Update .appveyor.yml
Update .travis.yml
Update Makefile
Update .appveyor.yml
Fix bad sample
2016-11-11 07:45:06 -08:00
Stephen
186540e160 make cleanup 2016-11-06 16:27:24 -08:00
mahin
83c9eb9c2c changed 02hhx —> 02x in sample_x86_32_gdt_and_seg_regs.c 2016-11-02 03:50:53 +08:00
Adrian Herrera
e1a2cb5fe8 [samples] Added uc_context_* sample 2016-10-31 11:56:32 +01:00
Stephen
bc08bfda67 Unit testing in CI (#651)
- in appveyor, install clang and cmake in cygwin, enable package upgrades, and build cmocka and enable testing for gcc only
- in `gitignore`, ignore generated cmocka folder
- in travis, use brew in osx to install cmocka, and enable testing for gcc and clang on os x and linux
- in `Makefile`, change to use `uname -s` to determine os type
- make `install-cmocka-linux.sh`, a simple shell script to download and install cmocka on linux
- in `bindings/Makefile`, enable `make -c` to call subdirectory makefiles instead of `cd [dir] && make` and include environment variables for runtime access to generated libraries
- in `samples/Makefile`, change to use `uname -s` to determine os type, remove `clean_bins` from `all` command, and include `Werror` for compile strictness
- in `tests/unit/Makefile`, add `cflags` for compile time access to cmocka headers and library, include execute vars for runtime access to cmocka and unicorn libs
- in `tests/unit/test_tb_x86.c`, comment out assert that would not compile
2016-10-22 00:21:10 +08:00
esanfelix
fce82b9532 Fixed ARM sample to properly run THUMB code #638 2016-09-20 10:15:58 +02:00
4577
1f978de447 Remove BUILDDIR-specific code 2016-09-04 08:59:31 +02:00
Nguyen Anh Quynh
14a7628098 samples: fix print format specifies for uint64_t 2016-08-23 06:57:33 +08:00
Andrew Dutcher
9c720092d3 Add xmm register read/write samples in C and python 2016-08-14 18:45:59 -07:00
Nguyen Anh Quynh
0e0a1ca786 samples: more flexible .gitignore 2016-06-16 09:23:00 +08:00
Zach Riggle
93063d089b Add ASAN build target with UNICORN_ASAN or via './make.sh asan' 2016-04-20 16:16:06 -07:00
Nguyen Anh Quynh
d2ccc27cc8 samples: fix warning on printing 64bit int in sample_batch_reg.c 2016-04-18 12:54:21 +08:00
Nguyen Anh Quynh
cc6cbc5cf7 Merge branch 'memleak' into m2 2016-04-18 12:48:13 +08:00
Nguyen Anh Quynh
400f396a2a samples: code style for sample_batch_reg.c 2016-04-06 09:48:38 +08:00
Ryan Hileman
159f9310aa add sample_batch_reg 2016-04-04 20:59:42 -07:00
Chris Eagle
3ca072e0de pack SegmentDescriptor to eliminate any alignment ambiguity 2016-03-28 09:29:55 -07:00
Nguyen Anh Quynh
e44f8f2981 samples: code style for sample_x86_32_gdt_and_seg_regs.c 2016-03-27 10:25:46 +08:00
Chris Eagle
6991d69dad merge from upstream 2016-03-25 19:46:44 -07:00
Nguyen Anh Quynh
3bb05fa8e9 samples: clean executable binaries before building 2016-03-25 22:30:04 +08:00
Chris Eagle
dc7ec51c6d file permissions 2016-03-24 08:57:00 -07:00
Chris Eagle
2825cfd07a add sample to Makefile 2016-03-24 08:56:13 -07:00
Chris Eagle
4c4203cec8 fix x86 segment setup by updating cached segment registers on reg_write 2016-03-22 23:54:30 -07:00
Adrian Herrera
903fb04f29 Another typo 2016-03-22 23:09:38 +11:00
Adrian Herrera
b5ea277900 Fixed minor typos 2016-03-22 22:32:59 +11:00
Nguyen Anh Quynh
fb1ebac000 Merge branch 'master' into m1 2016-03-09 15:13:42 +08:00
Nguyen Anh Quynh
a7a1dcc661 uc_hook_add(): add begin & end arguments for all hook types. also update Python binding after this change 2016-02-11 08:02:13 +08:00
Nguyen Anh Quynh
20b01a6933 fix merge conflict 2016-02-01 12:08:38 +08:00
Nguyen Anh Quynh
48ab148d1c Merge branch 'hook' 2016-01-26 22:52:29 +08:00
Nguyen Anh Quynh
235bf0950b cosmetic change for mem_apis.c 2016-01-26 22:50:35 +08:00
xorstream
26d3b1e7d6 Added ppc 32bit mode and added sparc mode checks to bring it in line with other archs 2016-01-24 22:27:33 +11:00
Nguyen Anh Quynh
38d1443504 Merge branch 'hook-refactor' of https://github.com/lunixbochs/unicorn into lunixbochs-hook-refactor 2016-01-23 13:24:12 +08:00
Ryan Hileman
1974b23164 add begin>end to samples/mem_apis 2016-01-22 19:55:31 -08:00
Nguyen Anh Quynh
d79925f477 sparc: add SPARC32 mode (= UC_MODE_32) 2016-01-23 10:48:18 +08:00
xorstream
8763d426c2 Fix uc_mode usage in source code 2016-01-23 12:08:49 +11:00
Nguyen Anh Quynh
69b784fc45 samples: LDFLAGS += -lpthread. this fixes issue 382 2016-01-19 09:11:25 +08:00
Nguyen Anh Quynh
7c9f851e72 sample: remove memleak test code in sample_x86.c 2016-01-11 00:08:04 +08:00
Nguyen Anh Quynh
cd6c98f5df sample: make hook_out() of sample_x86.c more deterministic 2016-01-10 23:25:05 +08:00
Hiroyuki Uekawa
6445c80b29 Build for Cygwin 2015-12-20 22:00:35 +09:00
Nguyen Anh Quynh
771f9f7c3b fix conflicts when merging map-ptr branch to master branch 2015-12-17 08:12:02 +08:00
xorstream
f68077852f Fixed includes for moved unicorn_dynload.h file 2015-12-15 17:17:14 +11:00
Nguyen Anh Quynh
1b145f431b code style 2015-12-10 00:53:48 +08:00
xorstream
514715f7d5 Added previously ignored project dirs to MSVC support for unicorn samples. 2015-12-08 19:26:53 +11:00
xorstream
c5c13e110a Added samples projects for MSVC binding.
Added MSVC support to unicorn samples.
2015-12-08 18:21:32 +11:00
Ryan Hileman
230cbd5330 add permissions to map_ptr api 2015-11-28 11:28:31 -08:00
Nguyen Anh Quynh
f4882ae1a2 simplify code by replacing mem_map_start()/mem_map_finish() in uc.c with mem_map() 2015-11-28 18:26:08 +08:00
Nguyen Anh Quynh
8f1e8c0ab1 add sample code for API uc_mem_map_ptr() 2015-11-28 16:17:52 +08:00
practicalswift
2dc0451e3a Remove trailing whitespace. 2015-10-30 22:34:35 +01:00
Matt
938a118221 Fix typo in register name
Register should be `edx` (not `dex`).
2015-10-15 20:38:44 +02:00
Nguyen Anh Quynh
9e64cba6ec Rename some hook related enums:
- UC_ERR_READ_INVALID -> UC_ERR_READ_UNMAPPED
 - UC_ERR_WRITE_INVALID -> UC_ERR_WRITE_UNMAPPED
 - UC_ERR_FETCH_INVALID -> UC_ERR_FETCH_UNMAPPED
 - UC_MEM_READ_INVALID -> UC_MEM_READ_UNMAPPED
 - UC_MEM_WRITE_INVALID -> UC_MEM_WRITE_UNMAPPED
 - UC_MEM_FETCH_INVALID -> UC_MEM_FETCH_UNMAPPED
 - UC_HOOK_MEM_READ_INVALID -> UC_HOOK_MEM_READ_UNMAPPED
 - UC_HOOK_MEM_WRITE_INVALID -> UC_HOOK_MEM_WRITE_UNMAPPED
 - UC_HOOK_MEM_FETCH_INVALID -> UC_HOOK_MEM_FETCH_UNMAPPED
 - UC_HOOK_MEM_INVALID -> UC_HOOK_MEM_UNMAPPED

This also renames some newly added macros to use _INVALID postfix:

 - UC_HOOK_MEM_READ_ERR -> UC_HOOK_MEM_READ_INVALID
 - UC_HOOK_MEM_WRITE_ERR -> UC_HOOK_MEM_WRITE_INVALID
 - UC_HOOK_MEM_FETCH_ERR -> UC_HOOK_MEM_FETCH_INVALID
 - UC_HOOK_MEM_ERR -> UC_HOOK_MEM_INVALID

Fixed all the bindings Java, Go & Python.
2015-09-30 14:46:55 +08:00
Nguyen Anh Quynh
886946dcf4 do not use syscall to quit emulation. this can fix issues #147 & #148 2015-09-26 16:49:00 +08:00
Nguyen Anh Quynh
2599d41404 add some hooking macros for all kind of memory access events 2015-09-24 19:21:31 +08:00
Nguyen Anh Quynh
90eb8f2e72 This commit continues the PR #111
- Allow to register handler separately for invalid memory access
- Add new memory events for hooking:
   - UC_MEM_READ_INVALID, UC_MEM_WRITE_INVALID, UC_MEM_FETCH_INVALID
   - UC_HOOK_MEM_READ_PROT, UC_HOOK_MEM_WRITE_PROT, UC_HOOK_MEM_FETCH_PROT
- Rename UC_ERR_EXEC_PROT to UC_ERR_FETCH_PROT
- Change API uc_hook_add() so event type @type can be combined from hooking types
2015-09-24 14:18:02 +08:00
Nguyen Anh Quynh
548355acca sparc: do not accept BIGENDIAN mode in samples. more sanity check should be done in the core 2015-09-11 14:02:27 +08:00
Jonathon Reinhart
2c0556826f samples: remove (uint8_t*) casts to mem API calls
These casts are now unnecessary.
2015-09-07 13:09:05 -04:00
Nguyen Anh Quynh
d1bdbd11e7 rename uchook to uc_hook, ucengine to uc_engine, uc_hook_t to uc_hook_type 2015-09-05 11:20:32 +08:00
Nguyen Anh Quynh
74c069dc22 samples: cleanup & put mem_apis into sample_all.sh 2015-09-05 09:42:47 +08:00
Nguyen Anh Quynh
7b5bb95147 Merge branch 'master' of https://github.com/unicorn-engine/unicorn 2015-09-05 09:12:23 +08:00
Chris Eagle
cbf9885b85 clean up comiler warnings 2015-09-04 10:35:39 -07:00
Chris Eagle
0b676a82d4 Merge remote-tracking branch 'upstream/master' 2015-09-04 10:27:33 -07:00
Chris Eagle
e9c6b11506 add mem_api sample program and fix check for wrong NX related constant in cputlb.c 2015-09-04 10:27:03 -07:00
Nguyen Anh Quynh
51a4fe0766 samples: cleanup shellcode.c 2015-09-05 00:59:53 +08:00
pancake
e89174c3f1 Fix build of regress/ 2015-09-04 07:56:35 -04:00
Chris Eagle
8cfd902e4b Move mem_xxx samples to regress. Add check to only flush tlb when unmapping if there is a current cpu 2015-09-04 00:48:24 -07:00
Jonathon Reinhart
5f32e2c1ae s/uc_hook_h/uchook/g 2015-09-03 22:39:23 -04:00
Jonathon Reinhart
da46071c7d bring new code and samples up-to-date with API changes 2015-09-03 22:15:49 -04:00
Jonathon Reinhart
5e9d07a40a Merge remote-tracking branch 'upstream/master' into change-handle-based-api 2015-09-03 22:01:52 -04:00
Nguyen Anh Quynh
0962c4822b cleanup & update bindings' constants 2015-09-04 09:43:31 +08:00
Chris Eagle
2da46caef7 smooth out split_region related code 2015-09-03 12:26:36 -07:00
Nguyen Anh Quynh
9f9d57e84f cleaning & indentation 2015-09-03 18:16:49 +08:00
Jonathon Reinhart
5b62d436a9 change public APIs to use ucengine
See #52.
2015-09-02 22:00:09 -04:00
Chris Eagle
2c4f3769d4 clean up mem_protect related constants and error codes 2015-09-01 12:10:09 -07:00
Chris Eagle
9e4e96ff47 final updates for uc_mem_unmap, uc_mem_protect, and support ro UC_PROT_EXEC permission 2015-08-30 19:50:18 -07:00
Chris Eagle
05b645abd5 fix perms 2015-08-30 14:01:46 -07:00
Chris Eagle
394461b941 section splitting complete for uc_mem_protect 2015-08-30 14:01:07 -07:00
Jonathon Reinhart
3bd705a060 Merge remote-tracking branch 'upstream/master' into change-handle-based-api 2015-08-30 00:23:51 -04:00
Chris Eagle
986096d443 fix file perms 2015-08-28 21:05:38 -07:00
Chris Eagle
94ac0f02e6 file permissions changes 2015-08-28 20:03:36 -07:00
Chris Eagle
65787d415a rename uc_mem_map_ex to uc_mem_map and all associated changes 2015-08-28 20:02:21 -07:00
Nguyen Anh Quynh
d3de7aa567 samples: add sample code for hooking SYSCALL instruction in sample_x86.c 2015-08-29 00:22:11 +08:00
Nguyen Anh Quynh
162728c1b1 samples: add shellcode to sample_all.sh 2015-08-29 00:02:52 +08:00
Jonathon Reinhart
db563bfcdb samples: update sample_m68k to use new API 2015-08-26 09:02:17 -04:00
Jonathon Reinhart
0202a57d32 samples: update shellcode.c to use new API 2015-08-26 09:02:17 -04:00
Jonathon Reinhart
4c9e78d2f9 samples: update sample_x86 to use new API 2015-08-26 09:02:17 -04:00
Jonathon Reinhart
fa11e9dddb samples: update sample_sparc to use new API 2015-08-26 09:02:17 -04:00
Jonathon Reinhart
0d69d81c2e samples: update sample_arm64 to use new API 2015-08-26 09:02:17 -04:00
Jonathon Reinhart
7406367a34 samples: update sample_arm to use new API 2015-08-26 09:02:17 -04:00
Jonathon Reinhart
7ac92ac50a samples: update sample_mips to use new API 2015-08-26 09:02:17 -04:00
Nguyen Anh Quynh
192f07c503 reset invalid_error after callbacks decide to continue after invalid memory accesses 2015-08-26 16:15:38 +08:00
Nguyen Anh Quynh
22b549a4db x86: add sample for 16bit mode 2015-08-26 09:25:29 +08:00
Nguyen Anh Quynh
c55ad00e2a samples: use -e rather than -a to check for file existence in Makefile 2015-08-24 17:48:30 +08:00
mothran
2516de7ed8 renamed m68k enum constants 2015-08-23 21:56:24 -07:00
mothran
a167f7c456 renames the register constants so unicorn and capstone can compile together 2015-08-23 21:36:33 -07:00
Nguyen Anh Quynh
344d016104 import 2015-08-21 15:04:50 +08:00