Commit graph

238 commits

Author SHA1 Message Date
xorstream 8763d426c2 Fix uc_mode usage in source code 2016-01-23 12:08:49 +11:00
Nguyen Anh Quynh 6490b4f2a9 arm64: fix the issue of multiple definition of aarch64_tb_set_jmp_target (issue #387) 2016-01-22 22:44:18 +08:00
Nguyen Anh Quynh 309abbe453 remove qemu/config-all-disas.mak 2016-01-22 17:11:57 +08:00
Nguyen Anh Quynh 3eb51116b9 arm64: fix the access to tcg_op_defs[] in arm64 backend (issue #387) 2016-01-22 11:35:01 +08:00
Nguyen Anh Quynh 840eb54f05 Revert "arm64: fix the access to tcg_op_defs[] in arm64 backend (issue #387)"
This reverts commit 3000ca6abf.
2016-01-22 11:33:36 +08:00
Nguyen Anh Quynh 3000ca6abf arm64: fix the access to tcg_op_defs[] in arm64 backend (issue #387) 2016-01-22 11:33:28 +08:00
Nguyen Anh Quynh 07bd81bda6 do not redefine tb_set_jmp_target1. this partly fixes issue #387 2016-01-22 11:29:22 +08:00
Nguyen Anh Quynh 839ef672b0 only declare use_idiv_instructions_rt when __ARM_ARCH_EXT_IDIV__ is not defined 2016-01-19 00:19:28 +08:00
Nguyen Anh Quynh 3b52af4fbd avoid confusion between macro & variable use_idiv_instructions (ARM backend) 2016-01-18 23:53:50 +08:00
Nguyen Anh Quynh d9249b91c2 add some missing symbols for ARM backend 2016-01-18 20:42:45 +08:00
petevine 8db7f79daf Finish adding getauxval 2016-01-18 12:48:49 +01:00
petevine 1bf85461c2 Add getauxval.c back 2016-01-18 12:47:32 +01:00
Nguyen Anh Quynh 7695fb1578 x86: no need to reset env->invalid_error in x86_reg_reset() as we always do that in cpu_exec() 2016-01-12 01:01:11 +08:00
farmdve c9f4bd27cc Reset env->invalid_error before executing a translation block. 2016-01-11 18:12:57 +02:00
Nguyen Anh Quynh 13726b3d40 Merge branch 'master' into cygwin 2016-01-07 23:17:32 +07:00
farmdve 2304bbfc96 Remove more instances of tcg_register_jit 2016-01-07 16:39:41 +02:00
Nguyen Anh Quynh bfeb08d1ba fix some compilation warning 2016-01-06 14:11:21 +08:00
Nguyen Anh Quynh e8a295991f update qemu/header_gen.py 2016-01-06 00:44:29 +07:00
Nguyen Anh Quynh e0cb02569e remove unused tcg_register_jit() and related code 2016-01-05 16:02:34 +07:00
Nguyen Anh Quynh 075ccadbe9 x86: set s->pc in disas_insn() early to fix uninitialized read issue. bug reported by @farmdve 2016-01-03 08:25:51 +07:00
Nguyen Anh Quynh 19930b0514 spaces 2016-01-01 14:15:01 +08:00
Nguyen Anh Quynh b3ebd1b7cb Merge branch 'master' of https://github.com/iroiro123/unicorn into iroiro123-master 2016-01-01 14:01:39 +08:00
Nguyen Anh Quynh f935469658 mips: handle memory redirect for all APIs. this fixes issue #347 2015-12-28 15:19:30 +08:00
Nguyen Anh Quynh f10d79e95f x86: fix a compilation warning on unused variable 2015-12-28 13:06:25 +08:00
Nguyen Anh Quynh b5feddbf1e indentation 2015-12-28 13:04:59 +08:00
Nguyen Anh Quynh 99b401c609 Merge branch 'la-fixed' of https://github.com/JCYang/unicorn into JCYang-la-fixed 2015-12-28 12:21:31 +08:00
Spl3en bb375e4fa9 Reset correctly the register CR0 in protected mode by calling cpu_x86_update_cr0 instead of setting it manually. 2015-12-25 04:55:15 +01:00
Spl3en 9ca993d8aa Restore the protected mode check. 2015-12-24 18:39:19 +01:00
Spl3en 4c3ad139ea (Fix #341) SYSENTER instruction is not properly hooked with uc_hook_add in x86 emulation.
helper_sysenter in qemu/target-i386/seg_helper.c didn't check properly if a call interrupt callback was registred.
It has been fixed by copying the helper_syscall behavior.
2015-12-24 16:00:22 +01:00
Nguyen Anh Quynh ed319bda0b x86: identity map guest address to host address. this fixes issue #300 2015-12-24 09:51:17 +08:00
Nguyen Anh Quynh 4117a111eb mips: handle hook callback for blikely instruction properly. this fixes issue #330, #331 2015-12-23 01:40:03 +08:00
JC Yang 8ef018a2cb Fix possible wrong conditional branch in generated host code by fixing
the tcg_liveness_analysis().
Refer to https://github.com/unicorn-engine/unicorn/issues/287 for further info.
2015-12-21 18:01:01 +08:00
Hiroyuki Uekawa 6445c80b29 Build for Cygwin 2015-12-20 22:00:35 +09:00
Nguyen Anh Quynh b72671c6d5 sparc, arm, m68k: check for exit request after every hooked instruction 2015-12-20 12:28:15 +08:00
Nguyen Anh Quynh 4f268febb4 mips: check for exit request after every hooked instruction. this fix issue #329 2015-12-20 12:23:36 +08:00
Nguyen Anh Quynh 771f9f7c3b fix conflicts when merging map-ptr branch to master branch 2015-12-17 08:12:02 +08:00
Nguyen Anh Quynh 8d3265d9e1 mips: remove unused variable is_bc_slot 2015-12-16 23:06:17 +08:00
xorstream 395251d3e8 Fix codehook for MIPS instructions in delay slot 2015-12-15 17:02:56 +11:00
Nguyen Anh Quynh 74aeef217c Merge branch 'master' of https://github.com/unicorn-engine/unicorn 2015-12-13 13:11:54 +08:00
Nguyen Anh Quynh bc63102e50 mips: only patch instruction size when there is a callback on the instruction. this fixes issue #282 2015-12-13 13:11:40 +08:00
farmdve 8b79a872d0 Fix segfault introduced in my previous commits. 2015-12-11 22:35:25 +02:00
Nguyen Anh Quynh f21fa3d966 do not flush TB when l1_map is uninitialized. this fixes issue #280, #284 2015-12-12 03:09:38 +08:00
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
Ryan Hileman 230cbd5330 add permissions to map_ptr api 2015-11-28 11:28:31 -08:00
Nguyen Anh Quynh 4a759cebb5 set permission for memory region allocated by memory_map_ptr(). this fixes the segfault in sample_x86.c, function test_x86_map_ptr() 2015-11-28 17:11:27 +08:00
Ryan Hileman 6d21ebabea implement host-controlled memory mapping for #261 2015-11-27 23:30:36 -08: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
Nguyen Anh Quynh 2929138c99 sparc: do not call INSN handler on until-address, and verify until-address early when translating block in JIT frontend. 2015-09-08 13:26:53 +08:00
Nguyen Anh Quynh 7a5d790ade rename UC_MEM_EXE to UC_MEM_FETCH 2015-09-08 12:55:56 +08:00
Nguyen Anh Quynh c1dd9fbfdf arm64: handle SP register. this fixes issue #122 2015-09-08 08:40:42 +08:00
Nguyen Anh Quynh 6c132bc673 arm: fix #114 by enabling cortex-a15 model. FIXME: enable this on demand with an API 2015-09-08 01:08:37 +08:00
Nguyen Anh Quynh 3ac8615cbb arm: handle invalid instruction. this fixes issue #114 2015-09-08 00:43:09 +08:00