Commit Graph

143 Commits

Author SHA1 Message Date
Nguyen Anh Quynh
a142611f56 sparc: set compute functions for icc_table[] & xcc_table[]. this fixes issue #289 2015-12-12 00:41:09 +08:00
Nguyen Anh Quynh
74986cc59a g_free() can handle NULL pointer 2015-12-11 11:25:35 +08:00
farmdve
3e57615c76 Fix uc_mem_unmap memory leak and in uc_close.
It appears the problem is that we are not calling the memory region
destructor. After modifying memory_unmap to include the destructor call
for the memory region, the memory is freed.

Furthermore in uc_close we must explicitly free any blocks that were not
unmapped by the user to prevent leaks.

This should fix issue 305.
2015-12-11 02:42:31 +02:00
Nguyen Anh Quynh
42b8879bb2 Merge branch 'master' of https://github.com/farmdve/unicorn into farmdve-master 2015-11-18 00:45:55 +08:00
Nguyen Anh Quynh
3302b9798c add some debug helper on generated machine code 2015-11-18 00:43:18 +08:00
farmdve
65a649dec0 Fix issue #269
Patch from here
http://lists.nongnu.org/archive/html/qemu-devel/2015-11/msg03848.html

Also fix another potential issue with constants from
bbeb82395e (diff-9e0011b4d4a5890b309421630e6d86c3)
2015-11-17 18:34:38 +02:00
Nguyen Anh Quynh
edaea7020b x86: on self-modifying code, generate JIT code until end of block. this fixes issue #266 2015-11-16 21:55:42 +08:00
Nguyen Anh Quynh
9099755ca1 flush JIT cache before finishing emulation. this fixes issue #263. TODO: optimize this for better performance 2015-11-13 23:57:03 +08:00
farmdve
1ba39a582c change tabs to whitespaces... 2015-11-13 16:53:01 +02:00
farmdve
661714d0c2 Potential fix for issue #262/#263 2015-11-13 16:51:59 +02:00
Nguyen Anh Quynh
d126644bb2 Merge pull request #259 from lunixbochs/multiarch
improve multiarch support
2015-11-12 15:11:06 +08:00
Ryan Hileman
ad5cd37551 improve multiarch support 2015-11-11 22:48:21 -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
Nguyen Anh Quynh
938d0b89eb x86: check for exit request after every hooked instruction. this should fix issue #232 2015-11-07 01:02:45 +08:00
Nguyen Anh Quynh
51323c9c17 x86: properly calculate EFLAGS when UC_HOOK_CODE is used. this should fix issue #246 2015-11-05 20:26:39 +08: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
Ryan Hileman
8c60d0dca5 allow setting x86 segment base to host-sized value 2015-10-23 00:15:08 -07:00
Nguyen Anh Quynh
142d3a6f72 arm: allow to read CPSR register 2015-10-17 15:59:27 +08:00
Nguyen Anh Quynh
600a1af710 Merge branch 'master' of https://github.com/unicorn-engine/unicorn 2015-10-03 15:46:19 +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
3ca8774f1a arm: properly handle the case when first insn in block is until address 2015-09-30 14:42:08 +08:00
Nguyen Anh Quynh
4a42041a83 handle 'bad ram pointer' case. this fixes issue #159 2015-09-29 18:22:22 +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
53ce8f217d mips: handle delay slot better for branch instructions. this should fix issue #155 2015-09-27 15:05:40 +08:00
Nguyen Anh Quynh
728fe750b9 Merge pull request #140 from cherepanov74/master
Fixes crash on Windows 64bit
2015-09-27 11:10:02 +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
15f087be74 Merge branch 'master' of https://github.com/unicorn-engine/unicorn 2015-09-26 10:44:15 +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
14a01b5186 mips: handle delay slot so do not duplicate calling instruction handler. this fixes issue #133 2015-09-22 11:59:53 +08:00
Nguyen Anh Quynh
a853eb6363 mips, m68k: early check to see if the address of BB is the until address 2015-09-22 10:24:26 +08:00
danghvu
0c67f41ed9 Fix issue #118 2015-09-21 20:30:05 -05:00
Nguyen Anh Quynh
d7d4be25b1 arm64: early check to see if the address of this block is the until address 2015-09-21 10:26:33 +08:00
Nguyen Anh Quynh
9aa04d9496 tb_gen_code(): only check to link next page if tb->size > 0 (so we skip empty block) 2015-09-20 00:05:17 +07:00
Nguyen Anh Quynh
5005b4a6e2 arm: early check to see if the address of this block is the until address 2015-09-17 09:16:57 +07:00
Nguyen Anh Quynh
d6b9c31dc9 sparc: more cleanup 2015-09-16 16:04:12 +07:00
mothran
893e6abcbd first atttempt at SPARC64 fixes, no longer SEGV's, set CPU model to: Sun UltraSparc IV 2015-09-15 23:12:03 -07:00
mothran
f4894a1c77 removed unneed cases in the switch statement 2015-09-14 20:44:50 -07:00
mothran
6b521e9e9b update the sparc reg read/write to include o/l/i registers 2015-09-14 20:03:32 -07:00
cherepanov74
2fc483ec47 Fixes crash on Windows 64bit 2015-09-14 20:42:29 +02:00
mothran
7dc41a8e4e update the regwptr upon reset 2015-09-13 18:10:28 -07:00
mothran
657a6c3e25 modified the sparc reg get/set functions to use the current reg window ptr 2015-09-12 10:29:35 -07:00
Nguyen Anh Quynh
ab337ef65a Merge branch 'master' of https://github.com/unicorn-engine/unicorn 2015-09-11 15:58:58 +08:00
mothran
afecfee565 added SPARC sp / fp registers, also updated uint32_t's to uint64_t's in SPARC64 2015-09-10 23:20:52 -07: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
Nguyen Anh Quynh
18b6680e96 mips: disable debug output 2015-09-08 23:56:25 +08:00