Commit Graph

102 Commits

Author SHA1 Message Date
4083b87032 add new hook type UC_HOOK_MEM_READ_AFTER, adapted from PR #399 by @farmdve. updated all bindings, except Ruby & Haskell 2016-10-22 11:19:55 +08:00
ea54204952 Tweak some names in a few places, encapsulate the uc_context struct to hide it from users for some reason 2016-10-10 14:04:51 -07:00
1ab2154fe5 Change save/restore API to have explicit alloc/free functions. Python has explicit save/update functions. 2016-10-07 11:39:42 -07:00
a6e8564153 typo 2016-10-07 10:06:53 +08:00
73577cbcd1 rename uc_regstate_restore to uc_context_restore, uc_context_save to uc_context_save 2016-10-07 10:03:19 +08:00
e3b0e52013 Rename save/restore functions to match the style of the rest of the API 2016-09-28 21:21:44 -07:00
0ef2b5fd71 New feature: registers can be bulk saved/restored in an opaque blob 2016-08-20 04:14:07 -07:00
9a2a5b15d8 Rename unhandled CPU exception 2016-07-05 11:10:39 -05:00
9cdca5a32b Unhandled interrupt will halt execution 2016-07-04 17:07:57 -05:00
1c73753507 don't try to override native C++ data type 2016-06-06 19:05:05 -07:00
6ca8ba16fc Changed bool typedef from int to unsigned char. 2016-05-10 23:53:39 +10:00
544942cc64 Added MSVC bindings for uc_reg_write_batch() and uc_reg_read_batch() and fixed UC_HOOK_INSN hooking. 2016-05-10 23:29:11 +10:00
c45f791dd2 delete include/unicorn/platform.h 2016-04-30 08:41:12 +08:00
acd88856e1 add batched reg access 2016-04-04 20:51:38 -07:00
338fb0e81b Fix a typo in uc_hook_add documentation. 2016-03-07 17:52:08 +01:00
1087ba9dea [query] add UC_QUERY_PAGE_SIZE uc_query helper
Return the current page size used by the current arch.
Useful to call uc_mem_map() with memory/size aligned.

Signed-off-by: Nicolas PLANEL <nplanel@redhat.com>
2016-03-04 15:54:24 +11:00
871cdb692f Merge branch 'hook' 2016-02-17 09:37:17 +08:00
f267ff2b17 Update unicorn.h
remove an outdated line on UC_QUERY_MODE
2016-02-15 10:27:20 +08:00
0822c0af85 bump API version to 1.0 2016-02-11 08:05:15 +08:00
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
a2ef52172c add combination hook type UC_HOOK_MEM_VALID to intercept all valid memory access 2016-01-31 13:12:34 +08:00
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
6f3d48077e rename UC_QUERY_ARM_MODE to a more generic name UC_QUERY_MODE. make all bindings support this new constant 2016-01-24 01:08:23 +08:00
4dbad9aa9b add new API uc_query() to query internal status of emulator at runtime 2016-01-23 17:14:44 +08:00
d79925f477 sparc: add SPARC32 mode (= UC_MODE_32) 2016-01-23 10:48:18 +08:00
288ef1df0a Fix uc_mode usage in source code 2016-01-23 12:10:12 +11:00
8763d426c2 Fix uc_mode usage in source code 2016-01-23 12:08:49 +11:00
82b7599e15 Sorted uc_modes by CPU and added masks 2016-01-23 09:47:29 +11:00
b48fbf7520 Sorted uc_modes by CPU and added masks 2016-01-23 00:55:31 +11:00
789971eeb9 Sorted uc_modes by CPU and added masks 2016-01-23 00:53:34 +11:00
f5fa84d985 consistent style for docs of unicorn.h 2016-01-16 18:31:24 +08:00
978f671fa5 fix some comments in unicorn.h 2016-01-16 18:17:13 +08:00
3d8f413ce8 new API uc_mem_regions() to retrieve the list of memory regions mapped by uc_mem_map_*() 2016-01-16 16:57:17 +08:00
230cbd5330 add permissions to map_ptr api 2015-11-28 11:28:31 -08:00
6d21ebabea implement host-controlled memory mapping for #261 2015-11-27 23:30:36 -08:00
2f297bdd3a handle some errors properly so avoid exit() during initialization. this fixes issue #237 2015-11-12 01:43:41 +08:00
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
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
5055899514 clarify that UC_HOOK_INTR is also for handling syscall events 2015-09-27 11:29:19 +08:00
dc1e9d3626 remove UC_HOOK_*_ALL hook types as they are not for same hook handlers 2015-09-24 23:23:05 +08:00
aa546ba7d6 add UC_HOOK_MEM_ALL macro to hook all kind of memory accesses 2015-09-24 20:59:45 +08:00
2599d41404 add some hooking macros for all kind of memory access events 2015-09-24 19:21:31 +08:00
738b8d89f9 correct instructions for uc_cb_hookmem_t & uc_cb_eventmem_t. this fixes a part of issue #151 2015-09-24 18:50:49 +08:00
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
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
2ef59e5727 Renamed UC_HOOK_MEM_INVALID_[READ/WRITE/FETCH] to
UC_HOOK_MEM_[READ/WRITE/FETCH]_INVALID as per aquynh's feedback.
2015-09-23 12:48:13 +07:00
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
75c5904ec1 Makes the hook types consistent, with a single indicator for each of
read, write and fetch.

This commit only adds the enum values. The functionality still has to be
updated.

As per issue #111
2015-09-22 12:26:01 +07:00
113245e12a fix some comments in unicorn.h 2015-09-09 17:00:00 +08:00
39ac1bcb4e rename UC_ERR_INVAL to UC_ERR_ARG 2015-09-09 16:54:47 +08:00