Commit Graph

319 Commits

Author SHA1 Message Date
Nguyen Anh Quynh fbef45b18f remove UC_ERR_TIMEOUT, so timeout on uc_emu_start() is not considered error. added UC_QUERY_TIMEOUT to query exit reason 2020-05-24 23:54:45 +08:00
el poto rico 149121539b
[arm64] Add some cool registers (#1253)
I've added the following registers to the API:

 * PSTATE
 * Exception link registers (ELR_ELx)
 * Stack pointers registers (SP_ELx)
 * MMU (TTBRn_EL1)
 * Exception syndrom registers (ESR_ELx)
 * Faulting virtual address registers (FAR_ELx)
 * PAR (PAR_EL1)
 * MAIR (MAIR_EL1)
 * Vector base address registers (VBAR_ELx)
2020-05-10 21:50:00 +08:00
BAYET 881e08da01
Fix UAF when deleting hook while in hook callback #1127 (#1130)
* Handle the cpu context save in a more pythonic way, so the context can be serialized and reuse in an other process using the same emulator architecture and modes

* Fix type error ; mistakes a size_t uint64_t ; breaks in 32bit...

* Fix the UAF situation when deleting a hook while being in a hook callback. Added an attribute 'to_delete' to hooks, and a list hooks_to_del to delay the free of the hooks

* Minor fixes ; forgot return type of clear_deleted_hooks ; do not declare variable in for predicate
2020-05-07 14:24:48 +08:00
Charles Ferguson f0b509c176
Ensure that hooks are unaffected by a request to stop emulation. (#1154)
This change removes the check for stop requests from the hook loop
macro.

Requests to stop emulation (uc_emu_stop) should only affect whether
the emulation stops. This isn't the case at present for the invocation
of hooks. If emulation is requested to be stopped (which is indicated
by `uc->stop_request`), the hooks will skip all execution. This means
that when the emulation stop is requested, some expected operations
may not occur before the emulation exits - leaving the system in an
inconsistent or broken state.

This is particularly obvious in the case where a CPU interrupt is
required, and a hook has been registered for such cases. The expected
operation is that the hook be called, and no CPU exception be raised
(because the hook has handled it). However, because of the short-cut
in the case where the `uc_emu_stop` function has been called out of
band (eg on another thread), this hook would not be called. In such
cases the execution would terminate with an error that an 'unhandled
CPU exception' occurred, and the hook would never have been called.

This probably affects other parts of the system, such as hooks which
handle remapping of memory on demand (UC_HOOK_MEM_READ_UNMAPPED and
friends) where the remap would not happen and instead an error about
the unmapped memory would be raised.

In all cases, it makes sense that execution continue normally until
the outer loop which controls the execution determines that the
emulation should stop. This will mean that for any given sequence of
events all the emulation operations are completed deterministically
regardless of when the stop request was received.
2020-05-05 08:36:50 +08:00
Dominik Maier 625399774c
X64 base regs (#1166)
* x86: setup FS & GS base

* Fixed base register writes for x64, removed then for x16/x32 (the don't exist there?)

* FS reg comes before GS so the base regs do so, too

* added shebang to const_generator.py

* Added base regs to and added 'all' support to const_generator

Co-authored-by: naq <aquynh@gmail.com>
2020-05-05 08:34:51 +08:00
ζeh Matt 3a3bc0c22d Timeout error (#1173)
* Implement timeout state and new error for such case

* Adjust test_i386_loop sample

* Adjust test_i386_loop test
2019-12-29 00:16:54 +08:00
meta ba74552199 Expose different 32-bit ARM CPU models to users via UC_MODE flags (#1165) 2019-10-26 05:01:00 +08:00
Azertinv 07f94ad1fc Added an invalid instruction hook (#1132)
* first draft for an invalid instruction hook

* Fixed documentation on return value of invalid insn hook
2019-09-23 01:53:06 +08:00
Chen Huitao 60896de9f4 add CMakeList.txt. build windows binary by using vs2019. (#1134)
* add CMakeList.txt. build windows binary by using vs2019.

* remove macro redefinition warning.

* add nmake.bat.

* update CMakeLists.txt. build successfully on Ubuntu-1804-amd64.

* add CMakeList.txt. build windows binary by using vs2019.

* remove macro redefinition warning.

* add nmake.bat.

* update CMakeLists.txt. build successfully on Ubuntu-1804-amd64.

* Add build specific arch option.

* fix old MSVC inline and mipsel macro.

* add install target and option of embeded MSVCRT lib.

* add cmake.sh and document.

* add xwings and chenhuitao as programmer.

* fix COMPILE-CMAKE. rename txt to md.
2019-09-08 16:42:43 +08:00
BAYET 8987ad0fff Handle serialization of cpu context save (#1129)
* Handle the cpu context save in a more pythonic way, so the context can be serialized and reuse in an other process using the same emulator architecture and modes

* Fix type error ; mistakes a size_t uint64_t ; breaks in 32bit...
2019-09-07 19:09:17 +08:00
kj.xwings.l 24f55a7973 Removed hardcoded CP0C3_ULRI (#1098)
* activate CP0C3_ULRI for CONFIG3, mips

* updated with mips patches

* updated with mips patches

* remove hardcoded config3

* git ignore vscode

* fix spacing issue and turn on floating point
2019-07-06 17:53:02 +08:00
yhql 3185128031 Add ARM MSP, PSP and CONTROL register access (#1071)
Necessary for NVIC exception emulation from user.
2019-03-07 08:37:27 +08:00
cfrantz 6c319941a5 Add support for the ARM IPSR register. (#1067)
1. Create an enum name for the IPSR register.
2. Implement read and write of the IPSR via the xpsr helper functions.

Fixes #1065
2019-02-28 09:55:27 +08:00
dmarxn 256e7782ce Added MXCSR register, fixed writing to FPUCW. (#1059)
* Added MXCSR register for reading and writing

* Changed writing for fpucw register, now the qemu rounding status is updated as well
2019-02-15 12:59:49 +08:00
Tasuku SUENAGA a.k.a. gunyarakun da5f2fc883 Fix wrong register aliases on arm64 (#922) 2017-12-20 22:09:38 +08:00
Nguyen Anh Quynh e6c27cfbd5 LGPL2 for all header files under include/unicorn/ 2017-12-16 10:08:42 +08:00
Nguyen Anh Quynh fe466d003a callback to count number of instructions in uc_emu_start() should be executed first. fix #727 2017-06-16 13:22:38 +08:00
misson20000 3fdb2d2442 add architecture query (#842) 2017-05-21 09:47:02 +08:00
bulaza 14222bd5f0 Update UC_HOOK_MEM_VALID (#837)
* Update UC_HOOK_MEM_VALID

UC_HOOK_MEM_READ fires before handlers for invalid memory reads, so UC_HOOK_MEM_VALID would technically also be receiving invalid memory reads. Switching to UC_HOOK_MEM_READ_AFTER ensures that only actually valid reads are hooked

* Removed macro change, added comment

Removed the macro change, but added a clarifying comment. May submit a future PR with a new macro added

* Update unicorn.h

will -> may

* Update unicorn.h
2017-05-18 08:12:46 +07:00
misson20000 014ccfb94a Aarch64 add thread registers (#834)
* add thread registers to AArch64

* update bindings to add AArch64 thread registers

* fix indentation for register read/write switch-case in unicorn_aarch64.c
2017-05-14 14:42:49 +07:00
bulaza 476553223b Fixing issues with const_generator.py (#832) 2017-05-14 00:16:48 +07:00
bulaza 4b9efdc986 Adding INSN hook checks for x86 (#833)
* adding INSN hook checking for x86

* tabs to spaces

* need to return bool not uc_err

* fixed conditional after switching to bool
2017-05-14 00:16:17 +07:00
bulaza e95edd37f3 Update unicorn.h (#821)
Further clarifying the comments I PRed last week.
2017-05-06 22:32:00 +08:00
Ryan Hileman 187b470245 add arm64 CPACR_EL1 register support (#814) 2017-05-02 14:51:19 +08:00
bulaza c09a52e803 Update comments on UC_MEM_*_UNMAPPED (#811)
Updated the comment on UC_MEM_*_UNMAPPED to clarify what happens if "true" is returned
2017-04-27 09:29:01 +08:00
bulaza f6908f03a9 Updated uc_close comment to clarify usage (#805) 2017-04-24 23:55:18 +08:00
Nguyen Anh Quynh dd07ae607c bump extra version to 2 2017-04-21 15:30:40 +08:00
Nguyen Anh Quynh e917c9de10 Merge branch 'master' into msvc2 2017-04-21 01:17:00 +08:00
Nguyen Anh Quynh 5dbc640b9a bump UC_VERSION_EXTRA to 1 2017-04-20 14:14:24 +08:00
Nguyen Anh Quynh 3b6779479e cleanup uc_priv.h 2017-03-30 15:59:13 +08:00
Nguyen Anh Quynh 094ca80092 fix conflicts 2017-03-30 12:23:24 +08:00
zhangwm d8fe34a2e8 armeb: Add support for ARM big endian. 2017-03-13 22:32:44 +08:00
Nguyen Anh Quynh c01dcf0a14 fix merge conflicts 2017-03-10 21:04:33 +08:00
Nguyen Anh Quynh f4325f8c4e bindings: update to support X86 MSR id 2017-02-24 21:51:01 +08:00
Ahmed Samy 02e6c14e12 x86: add MSR API via reg API (#755)
Writing / reading to model specific registers should be as easy as
calling a function, it's a bit stupid to write shell code and run them
just to write/read to a MSR, and even worse, you need more than just a
shellcode to read...

So, add a special register ID called UC_X86_REG_MSR, which should be
passed to uc_reg_write()/uc_reg_read() as the register ID, and then a
data structure which is uc_x86_msr (12 bytes), as the value (always), where:
	Byte	Value		Size
	0	MSR ID		4
	4       MSR val		8
2017-02-24 21:37:19 +08:00
Nguyen Anh Quynh 6ea39f7d5a merge msvc with master 2017-02-24 10:39:36 +08:00
fG! d5870ff47d Update unicorn.h (#753)
Make it clear that only very few instructions can be hooked
2017-02-21 10:22:17 +08:00
vardyh 7f9251511e MSVC port (vardyh) (#746)
* unicorn: use waitable timer to implement usleep() on Windows

Signed-off-by: vardyh <vardyh.dev@gmail.com>

* atomic: implement barrier() for msvc

Signed-off-by: vardyh <vardyh.dev@gmail.com>
2017-02-07 21:31:35 +08:00
Nguyen Anh Quynh b616115df1 update ChangeLog 2017-01-25 12:00:18 +08:00
Parker Thompson 053ecd7bf4 Added ARM coproc registers (#684)
* Added ARM coproc registers

* Added regression test for vfp
2017-01-25 11:56:19 +08:00
xorstream 2a941e3efb Finalise MSVC port (#739)
* Fix for MIPS issue.

* Sparc support added.

* M68K support added.

* Arm support ported.

* Fix issue with VS2015 shlobj.h file

* Arm issue fix.

* Finalise MSVC port.
2017-01-24 22:09:33 +08:00
xorstream 8e45102b43 Arm support ported. (#736)
* Fix for MIPS issue.

* Sparc support added.

* M68K support added.

* Arm support ported.

* Fix issue with VS2015 shlobj.h file
2017-01-23 23:30:57 +08:00
Nguyen Anh Quynh a0f7b526bd cleanup include/unicorn/*.h 2017-01-22 06:02:07 +08:00
xorstream 9fac29d154 Changed some MSVC compatibility defines based on MSVC version. (#724) 2017-01-21 20:21:27 +08:00
Nguyen Anh Quynh e98a396e68 fix include path of platform.h 2017-01-21 11:31:29 +08:00
Nguyen Anh Quynh 330e7cb87b cleanup platform.h 2017-01-21 11:02:59 +08:00
xorstream 770c5616e2 Automated leading tab to spaces conversion. 2017-01-21 12:28:22 +11:00
xorstream 429bfca48e Fixes for MSVC native support to still work with GCC/GNU. 2017-01-21 01:07:10 +11:00
xorstream fac6a66860 platform.h move #3 2017-01-21 00:13:21 +11:00
xorstream f4b375c651 platform.h moved. 2017-01-21 00:03:50 +11:00
xorstream b0ae2138fb Merge remote-tracking branch 'unicorn-engine/master' into msvc_native 2017-01-20 22:37:51 +11:00
xorstream 1fea4e6d87 Some small changes to clean up before pull request. 2017-01-20 22:34:14 +11:00
Nguyen Anh Quynh c6de7930c9 remove mutex code 2017-01-20 15:44:03 +08:00
xorstream 92392e0f57 Merge with current master. 2017-01-20 18:22:28 +11:00
Nguyen Anh Quynh 42771848d6 no more spinlock 2017-01-20 14:57:33 +08:00
xorstream 002151874a Unicorn interface working with test app in 32bit and 64bit builds. 2017-01-20 17:27:22 +11:00
Jonas ec6602a7e1 fixed documentation of uc_emu_stop (#721) 2017-01-20 06:19:43 +08:00
xorstream 1aeaf5c40d This code should now build the x86_x64-softmmu part 2. 2017-01-19 22:50:28 +11:00
xorstream d56d09e5e1 Merge remote-tracking branch 'unicorn-engine/master' into msvc_native 2017-01-16 17:26:12 +11:00
xorstream 940c857987 Started the port for MSVC native support. 2017-01-16 17:21:12 +11:00
Elton G 47150b6df3 reg_read and reg_write now work with registers W0 through W30 in Aarch64 (#716)
* reg_read and reg_write now work with registers W0 through W30 in Aarch64 emulaton

* Added a regress test for the ARM64 reg_read and reg_write on 32-bit registers (W0-W30)
Added a new macro in uc_priv.h (WRITE_DWORD_TO_QWORD), in order to write to the lower 32 bits of a 64 bit value without overwriting the whole value when using reg_write

* Fixed WRITE_DWORD macro

reg_write would zero out the high order bits when writing to 32 bit registers

e.g. uc.reg_write(UC_X86_REG_EAX, 0) would also set register RAX to zero
2017-01-15 20:13:35 +08:00
Nguyen Anh Quynh bc569f5a54 rename API uc_mem_free() to uc_free(). see #662 2017-01-10 20:59:14 +08:00
Nguyen Anh Quynh fdbbdc6216 rename uc_context_free() to uc_mem_free(). see #373 2017-01-09 20:52:14 +08:00
Nguyen Anh Quynh 52cb0ba78e cleanup more synchronization code 2017-01-09 14:05:39 +08:00
cojocar 428cb83060 Support for MCLASS ARM cpu (Cortex-M3) (#700)
Support for Cortex-M ARM CPU already exists in Qemu. This patch just
exposes a "cortex-m3" CPU.

"uc_open(UC_ARCH_ARM, UC_MODE_THUMB | UC_MODE_MCLASS, &uc);"
Instantiates a CPU with this feature on.

Signed-off-by: Lucian Cojocar <lucian@cojocar.com>
2016-12-27 22:49:06 +08:00
Nguyen Anh Quynh 7a1930a879 add UC_VERSION_{MAJOR, MINOR, EXTRA} 2016-10-25 14:37:47 +08:00
Nguyen Anh Quynh 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
Andrew Dutcher 80f35d3b2b remove safety checks, for some reason 2016-10-11 13:07:14 -07:00
Andrew Dutcher 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
Andrew Dutcher 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
Nguyen Anh Quynh a6e8564153 typo 2016-10-07 10:06:53 +08:00
Nguyen Anh Quynh 73577cbcd1 rename uc_regstate_restore to uc_context_restore, uc_context_save to uc_context_save 2016-10-07 10:03:19 +08:00
Nguyen Anh Quynh b7cdbe7a88 Merge branch 'feat/reg_save_restore' of https://github.com/rhelmot/unicorn into rhelmot-feat/reg_save_restore 2016-10-07 09:57:07 +08:00
Andrew Dutcher e3b0e52013 Rename save/restore functions to match the style of the rest of the API 2016-09-28 21:21:44 -07:00
Ryan Hileman cb615fdba7 remove uc->cpus 2016-09-23 07:38:21 -07:00
Nguyen Anh Quynh 69d976375e Merge branch 'fix/self_modifying' of https://github.com/rhelmot/unicorn into rhelmot-fix/self_modifying 2016-08-30 21:20:22 +08:00
Nguyen Anh Quynh 8b030ae51a fix for issue #523 2016-08-27 21:49:11 +08:00
Andrew Dutcher 0ef2b5fd71 New feature: registers can be bulk saved/restored in an opaque blob 2016-08-20 04:14:07 -07:00
Andrew Dutcher 97b10da133 Undo the disaster that was the patch to unicorn github issue #266 and fix it correctly. makes normal self-modifying code work. 2016-08-09 19:35:20 -07:00
Hoang-Vu Dang 9a2a5b15d8 Rename unhandled CPU exception 2016-07-05 11:10:39 -05:00
Hoang-Vu Dang 9cdca5a32b Unhandled interrupt will halt execution 2016-07-04 17:07:57 -05:00
Chris Eagle 1c73753507 don't try to override native C++ data type 2016-06-06 19:05:05 -07:00
xorstream 6ca8ba16fc Changed bool typedef from int to unsigned char. 2016-05-10 23:53:39 +10:00
xorstream 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
Nguyen Anh Quynh c45f791dd2 delete include/unicorn/platform.h 2016-04-30 08:41:12 +08:00
Nguyen Anh Quynh 3a742fb6f6 fix conflicts when merging no-thread to master 2016-04-23 10:06:57 +08:00
Nguyen Anh Quynh cc6cbc5cf7 Merge branch 'memleak' into m2 2016-04-18 12:48:13 +08:00
Nguyen Anh Quynh 47a7bb3c9f Merge branch 'smaller_nothreads' of https://github.com/cseagle/unicorn into cseagle-smaller_nothreads 2016-04-17 23:37:06 +08:00
Ryan Hileman acd88856e1 add batched reg access 2016-04-04 20:51:38 -07:00
Adrian Herrera fd825fb800 Added stdint include to x86.h
x86.h referenced types defined in stdint.h (e.g. uint16_t, etc.), but didn't
actually include stdint.h
2016-04-01 23:38:32 +11:00
Chris Eagle 9467254fc0 strip out per cpu thread code 2016-03-25 17:24:28 -07:00
Nguyen Anh Quynh fb1ebac000 Merge branch 'master' into m1 2016-03-09 15:13:42 +08:00
Spl3en 338fb0e81b Fix a typo in uc_hook_add documentation. 2016-03-07 17:52:08 +01:00
Nicolas PLANEL 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
Hiroyuki UEKAWA c5888e5670 move macros in `qemu/target-*/unicorn*.c` to `uc_priv.h` 2016-03-02 12:43:02 +09:00
Nguyen Anh Quynh 871cdb692f Merge branch 'hook' 2016-02-17 09:37:17 +08:00
Nguyen Anh Quynh b69feb8d0b Merge branch 'master' into memleak2 2016-02-15 15:52:10 +08:00
Nguyen Anh Quynh f267ff2b17 Update unicorn.h
remove an outdated line on UC_QUERY_MODE
2016-02-15 10:27:20 +08:00
Nguyen Anh Quynh 0822c0af85 bump API version to 1.0 2016-02-11 08:05:15 +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 ed77cacbf3 cosmetic change for uc_x86_mmr 2016-02-06 17:34:19 +08:00
Chris Eagle 49b9f4f8da uc_x86_mmr type available in qemu/target-i386/unicorn.c 2016-02-04 19:09:41 -08:00
Chris Eagle 59f7bf3be7 file perms 2016-02-04 16:48:27 -08:00
Chris Eagle e59382e030 updated gdtr/idtr/ldtr/tr read/write code 2016-02-04 16:44:52 -08:00
Chris Eagle 9977054a15 add support for setting gdtr, idtr, ldtr, and tr programatically 2016-02-03 09:22:29 -08:00
Nguyen Anh Quynh 20b01a6933 fix merge conflict 2016-02-01 12:08:38 +08:00
Nguyen Anh Quynh a2ef52172c add combination hook type UC_HOOK_MEM_VALID to intercept all valid memory access 2016-01-31 13:12:34 +08:00
Nguyen Anh Quynh e750a4e97c when uc_mem_exec() remove EXE permission, quit current TB & continue emulating with TB flushed. this fixes issue in PR #378 2016-01-28 00:56:55 +08:00
Nguyen Anh Quynh 48ab148d1c Merge branch 'hook' 2016-01-26 22:52:29 +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 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
Nguyen Anh Quynh 4dbad9aa9b add new API uc_query() to query internal status of emulator at runtime 2016-01-23 17:14:44 +08: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 9f9bd7098b patch hook bounds to be inclusive 2016-01-22 19:24:45 -08:00
Nguyen Anh Quynh 249e2ac0a0 Merge branch 'hook-refactor' of https://github.com/lunixbochs/unicorn into lunixbochs-hook-refactor 2016-01-23 10:58:37 +08:00
Nguyen Anh Quynh d79925f477 sparc: add SPARC32 mode (= UC_MODE_32) 2016-01-23 10:48:18 +08:00
Ryan Hileman 93052f6566 refactor to allow multiple hooks for one type 2016-01-22 18:41:43 -08:00
xorstream 288ef1df0a Fix uc_mode usage in source code 2016-01-23 12:10:12 +11:00
xorstream 8763d426c2 Fix uc_mode usage in source code 2016-01-23 12:08:49 +11:00
xorstream 82b7599e15 Sorted uc_modes by CPU and added masks 2016-01-23 09:47:29 +11:00
xorstream b48fbf7520 Sorted uc_modes by CPU and added masks 2016-01-23 00:55:31 +11:00
xorstream 789971eeb9 Sorted uc_modes by CPU and added masks 2016-01-23 00:53:34 +11:00
Nguyen Anh Quynh f5fa84d985 consistent style for docs of unicorn.h 2016-01-16 18:31:24 +08:00
Nguyen Anh Quynh 978f671fa5 fix some comments in unicorn.h 2016-01-16 18:17:13 +08:00
Nguyen Anh Quynh 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
farmdve 036763d6ae Fix memory leaks as reported by DrMemory and Valgrind.
ARM and probably the rest of the arches have significant memory leaks as
they have no release interface.

Additionally, DrMemory does not have 64-bit support and thus I can't
test the 64-bit version under Windows. Under Linux valgrind supports
both 32-bit and 64-bit but there are different macros and code for Linux
and Windows.
2016-01-08 01:42:56 +02:00
Ryan Hileman 230cbd5330 add permissions to map_ptr api 2015-11-28 11:28:31 -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
Nico01 4127179fe3 fix compilation with capstone next 2015-11-07 16:55:42 +01:00
farmdve 389bc06b49 Fix crash on 00 opcode.
l1_map should be an array of pointers, thus void **
2015-11-06 14:08:12 +02:00
Nguyen Anh Quynh 3a36e327ab support memory redirection, so the issue #217 is fixed 2015-10-27 14:37:03 +08: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
feliam 23b3f651f9 Indentation 2016-03-10 07:45:36 -03:00
feliam 0a3799eada FPU control word and tags 2016-03-09 19:14:33 -03: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 2b0b4169bc mips: advance PC for SYSCALL instruction. this fixes issue #157 2015-09-28 10:58:43 +08:00
Nguyen Anh Quynh 5055899514 clarify that UC_HOOK_INTR is also for handling syscall events 2015-09-27 11:29:19 +08:00
Nguyen Anh Quynh dc1e9d3626 remove UC_HOOK_*_ALL hook types as they are not for same hook handlers 2015-09-24 23:23:05 +08:00
Nguyen Anh Quynh aa546ba7d6 add UC_HOOK_MEM_ALL macro to hook all kind of memory accesses 2015-09-24 20:59:45 +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 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
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 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
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
Sean Heelan 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
mothran 1638372793 fix small whitespace issue 2015-09-14 20:48:31 -07:00
mothran d4d5631181 updated the sparc.h header so the alignment of certain registers was correct 2015-09-14 20:42:41 -07:00
Nguyen Anh Quynh 113245e12a fix some comments in unicorn.h 2015-09-09 17:00:00 +08:00