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
f57c098056
declare variables at begin of function
2015-11-28 15:56:19 +08:00
Ryan Hileman
6d21ebabea
implement host-controlled memory mapping for #261
2015-11-27 23:30:36 -08:00
Nguyen Anh Quynh
2f297bdd3a
handle some errors properly so avoid exit() during initialization. this fixes issue #237
2015-11-12 01:43:41 +08:00
Nguyen Anh Quynh
272293556a
do not abort() when memory is insufficient. this fixes issue #244
2015-11-10 11:44:29 +08:00
practicalswift
4151d1d600
Fix segfault-on-emu_stop() bug.
2015-11-03 14:34:31 +01:00
Nguyen Anh Quynh
b41db5abd9
Merge pull request #229 from practicalswift/typos
...
Fix typos. Remove trailing whitespace.
2015-10-31 10:39:35 +08:00
practicalswift
4f521c371c
Fix typos.
2015-10-30 22:32:59 +01:00
Nguyen Anh Quynh
b66a323b19
do not free MemoryRegion in memory_unmap() because it will be unref later in memory_region_unref(). this fixes issue #202
2015-10-28 01:26:59 +08:00
Nguyen Anh Quynh
3a36e327ab
support memory redirection, so the issue #217 is fixed
2015-10-27 14:37:03 +08:00
coco
dd56621bbb
fix for use after free in case of double unmap
2015-10-21 22:25:49 +02:00
Willi Ballenthin
34c7b70bcb
uc.c: fix minor typo
...
s/argumet/argument/g
2015-10-19 16:52:56 -04:00
Nguyen Anh Quynh
b1d41d414b
on some hook events, uc_hook_add() should not allow more than 1 handler. this add UC_ERR_HOOK_EXIST error type
2015-10-10 18:01:47 +08: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
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
Sean Heelan
dfb4a9d9ad
Revert "Remove uc_cb_eventmem_t as it is identical to uc_cb_hookmem_t"
...
As pointed out by aquynh the return types are actually different. A
uc_cb_eventmem_t callback returns a bool, while uc_cb_hookmem_t has a
void return type.
This reverts commit cb2b97f26c
.
2015-09-23 12:51:47 +07:00
Sean Heelan
cb2b97f26c
Remove uc_cb_eventmem_t as it is identical to uc_cb_hookmem_t, as per
...
issue #111
2015-09-22 12:37:05 +07:00
Nguyen Anh Quynh
26ee533303
return NULL in memory_mapping() if no memory is mapped. this fixes test_bad_unmap in test_x86.c
2015-09-21 22:17:26 +08:00
Nguyen Anh Quynh
39ac1bcb4e
rename UC_ERR_INVAL to UC_ERR_ARG
2015-09-09 16:54:47 +08:00
Nguyen Anh Quynh
d7ef204398
rename error codes ERR_MEM_READ, ERR_MEM_WRITE, ERR_MEM_FETCH
2015-09-09 16:25:48 +08:00
Nguyen Anh Quynh
d3d38d3f21
handle read/write/fetch from unaligned addresses. this adds new error codes UC_ERR_READ_UNALIGNED, UC_ERR_WRITE_UNALIGNED & UC_ERR_FETCH_UNALIGNED
2015-09-09 15:52:15 +08:00
Jonathon Reinhart
f6cecf45d2
change mem read/write APIs to use void*
...
Don't force the user to use uint8_t pointers, or cast their
pointers-to-other-objects to uint8_t* when calling these APIs.
2015-09-07 12:44:03 -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
d506b900eb
cache the last entry of mapped blocks in memory_mapping() for better performance
2015-09-04 15:40:47 +08:00
Nguyen Anh Quynh
022f8d82d1
handle memory fetch as invalid memory access. now we can also report error if exec memory is unmapped (UC_ERR_MEM_FETCH)
2015-09-04 11:55:17 +08: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
e54519c09f
cleanup
2015-09-04 09:20:13 +08:00
Chris Eagle
2da46caef7
smooth out split_region related code
2015-09-03 12:26:36 -07:00
Nguyen Anh Quynh
6ca85a72ed
simplify uc_mem_protect() & uc_mem_unmap()
2015-09-04 01:02:38 +08:00
Nguyen Anh Quynh
9f9d57e84f
cleaning & indentation
2015-09-03 18:16:49 +08:00
Nguyen Anh Quynh
b8d4240240
solve merging conflict
2015-09-03 18:05:21 +08:00
Jonathon Reinhart
5b62d436a9
change public APIs to use ucengine
...
See #52 .
2015-09-02 22:00:09 -04:00
Jonathon Reinhart
bd0a6921cc
Merge remote-tracking branch 'upstream/master' into change-handle-based-api
2015-09-02 21:04:43 -04:00
Nguyen Anh Quynh
03683a7960
fix an warning caused by _hook_mem_access()
2015-09-03 01:18:41 +08:00
Nguyen Anh Quynh
be659d201d
fix confusion betweet UC_MEM_xxx & UC_HOOK_MEM_xxx. fix issue #93
2015-09-03 01:13:57 +08:00
Nguyen Anh Quynh
8b39ec5b0c
initial support to remove a static variable in qemu-thread-win32.c
2015-09-02 16:13:12 +08:00
Chris Eagle
ad877e6af0
Add error value UC_ERR_INVAL and rename UC_ERR_OOM to UC_ERR_NOMEM to provide more error specificity
2015-09-01 13:40:19 -07:00
Chris Eagle
2c4f3769d4
clean up mem_protect related constants and error codes
2015-09-01 12:10:09 -07:00
Chris Eagle
658e399776
clean up mem_protect related constants
2015-08-31 19:08:48 -07:00
Chris Eagle
b27e987932
Add target_page_size member to uc_struct to track TARGET_PAGE_SIZE
2015-08-31 01:00:44 -07:00
Chris Eagle
410e317e92
dont use explicit page size, use TARGET_PAGE_SIZE
2015-08-30 21:24:14 -07:00
Chris Eagle
394461b941
section splitting complete for uc_mem_protect
2015-08-30 14:01:07 -07:00
Chris Eagle
0a60fa4c8a
fix perms
2015-08-30 00:22:49 -07:00
Chris Eagle
942de0f2ae
implemented basic block splitting, uc_mem_unmap should work for sub=blocks or across contiguous blocks
2015-08-30 00:22:18 -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
4a680b9277
Merge branch 'master' into mem_map_ex_cse
2015-08-29 21:22:33 -07:00
Chris Eagle
6beb1b8a13
intermediate commit, working unmap of complete blocks, still need sub-blocks, and cross block
2015-08-29 21:17:30 -07:00
Nguyen Anh Quynh
b4d7347fa8
wait for the timer thread to finish at the end of uc_emu_start(). this may fix the issue #78
2015-08-30 05:12:04 +08:00
Chris Eagle
592cbc6eaf
conflict resolution with merge master
2015-08-28 23:51:56 -07:00
Chris Eagle
8e2848c9d5
Merge branch 'master' into api_update
2015-08-28 20:05:53 -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
810054ca6d
uc_mem_read() & uc_mem_write() now can work on adjacent memory areas. this fixes issue #38
2015-08-29 10:23:53 +08:00
Chris Eagle
eab6167241
Merge branch 'master' into mem_map_ex_cse
2015-08-28 19:00:39 -07:00
Chris Eagle
9ba59e4988
Step one towards uc_mem_protect, uc_mem_unmap, and support for UC_PROT_EXEC and NX regions
2015-08-28 18:59:45 -07:00
Nguyen Anh Quynh
c0c24db4c6
chmod -x uc.c
2015-08-29 09:27:24 +08:00
Nguyen Anh Quynh
0db7d9ea4e
reset emulation_done in uc_emu_start()
2015-08-29 09:22:53 +08:00
Nguyen Anh Quynh
ab27c6aa04
return immediately if emulation is already done. this fixes issue #65
2015-08-29 09:10:18 +08:00
Chris Eagle
3452b47f7c
Add code to handle non-readable memory
2015-08-28 03:42:25 -07:00
Chris Eagle
aa509cc00f
delete redundant function
2015-08-28 02:20:56 -07:00
Chris Eagle
adc254cc74
Roll back uc_mem_protect changes
2015-08-28 01:37:49 -07:00
Chris Eagle
b31bb9638c
cleanup for pull request
2015-08-28 00:00:09 -07:00
Chris Eagle
9530b2daff
Remove MemoryBlock struct by consolidating in MemoryRegion. add new API uc_mem_protect. Add regress/mem_protect.c. Drop UC_PROT_EXEC for time being
2015-08-27 23:19:32 -07:00
Chris Eagle
686acb7e6e
Detect all occurences of write to read only page. Add callback capability on write to read only. Add new error type UC_ERR_MEM_WRITE_RO and new access type UC_MEM_WRITE_RO for use in callback
2015-08-27 18:03:17 -07:00
Chris Eagle
00944b6cde
Add ability to mark memory are read only. Add new API uc_mem_map_ex to allow permissions to be passed. Change MemoryBlock to track created MemoryRegions. Add regress/ro_mem_test.c
2015-08-26 13:29:54 -07:00
Nguyen Anh Quynh
b6dd516977
fix a bug on releasing mapped_blocks in uc_close()
2015-08-26 23:41:30 +08:00
Chris Eagle
5d8d251085
Free uc->mapped_blocks in uc_close
2015-08-26 08:23:36 -07:00
Jonathon Reinhart
20bdbf638d
change uc_hook_del() to take hook handle by value
2015-08-26 09:02:17 -04:00
Jonathon Reinhart
ad59de2b51
remove UC_ERR_UCH
...
not used anymore
2015-08-26 09:02:16 -04:00
Jonathon Reinhart
24caaa07de
change uch to uc_hook_h for hook handles
2015-08-26 09:02:16 -04:00
Jonathon Reinhart
5f89f9884e
change uch to uc_struct (uc.c)
2015-08-26 08:20:52 -04:00
Chris Eagle
9023e77201
Fixed bug introduced in uc_mem_map
2015-08-26 00:26:42 -07:00
Chris Eagle
e11c0629f9
Change allocation strategy for memory block tracking and track begin/end rather than begin/size
2015-08-25 23:08:18 -07:00
Chris Eagle
03e8b28d71
First cut at cleaning up uc_mem_map, eliminate map_begin and map_end, move tracking inside uc struct
2015-08-25 21:52:18 -07:00
Nguyen Anh Quynh
70cdbf8c69
uc_mem_map(): enforce address & size to be aligned to 4KB. this fixes bunch of regress tests in regress/
2015-08-26 11:29:14 +08:00
Nguyen Anh Quynh
c3e95ec34e
x86: do not generate basic-block callback when translation is broken in the middle due to full cache
2015-08-25 14:50:55 +08:00
Jonathon Reinhart
9163bba812
restore mode of .[ch] files
...
These were marked as executable in 5c3b6819
, likely due to a Windows
filesystem being involved. This can be avoided:
http://stackoverflow.com/q/1580596/119527
2015-08-24 21:19:12 -04:00
Chris Eagle
5c3b681945
Add const to uc_reg_write and derivitives
2015-08-24 09:42:50 -07:00
Chris Eagle
f221195bf6
Merge remote-tracking branch 'upstream/master'
2015-08-24 09:15:23 -07:00
Nguyen Anh Quynh
9d9c0d1a25
uc_emu_start() report error on illegal instruction at the output
2015-08-25 00:02:31 +08:00
pancake
c5d99777f4
Use const in uc_mem_write and derivates
2015-08-24 17:02:14 +02:00
Chris Eagle
2998c125de
Merge remote-tracking branch 'upstream/master'
2015-08-24 00:50:59 -07:00
Chris Eagle
73bc268036
Fix 8k alignment mask computation
2015-08-24 00:41:56 -07:00
mothran
2516de7ed8
renamed m68k enum constants
2015-08-23 21:56:24 -07:00
mothran
995924176a
Merge branch 'const_rename'
2015-08-23 21:42:02 -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
bb34eebd24
verify hardware mode for ARM. this fixes issue #16
2015-08-24 09:50:55 +08:00
Nguyen Anh Quynh
cd072b4e20
Merge pull request #22 from JonathonReinhart/supported-arch-api
...
clean-up uc_support() API
2015-08-24 09:32:22 +08:00
Jonathon Reinhart
11cc9ec9ba
clean-up uc_support() API
...
- rename to more obviously-named uc_arch_supported()
- remove UC_ARCH_ALL and associated test -- There's no point in having this
API, and it was improperly implemented anyway.
- remove now unneeded archs_enable() and all_arch
- add UNICORN_HAS_PPC test -- This seems to be only partially implemented
2015-08-23 21:10:47 -04:00
Ryan Hileman
76d8541717
add check for mem_map(size=0) ( #14 )
2015-08-23 14:16:40 -07:00
Nguyen Anh Quynh
761fd3d13b
fix issue #1
2015-08-24 01:07:03 +08:00
Nguyen Anh Quynh
f9b9dfbce9
fix issue #9
2015-08-24 00:52:00 +08:00
Nguyen Anh Quynh
4701fb80b4
code style: convert tabs to spaces
2015-08-23 09:06:31 +08:00
Nguyen Anh Quynh
e1baf2f36b
x86: support hooking SYSCALL/SYSENTER instructions. we no longer share the SYSCALL callback with interrupt instructions
2015-08-23 01:19:40 +08:00
Nguyen Anh Quynh
344d016104
import
2015-08-21 15:04:50 +08:00