Commit Graph

615 Commits

Author SHA1 Message Date
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
Nguyen Anh Quynh
9e4ed32e8a x86: handle SYSCALL even if there is no handler 2015-09-07 10:19:45 +08:00
Nguyen Anh Quynh
a166c24f8e x86: correct EIP of INT instruction by updating it only after calling interrupt handler 2015-09-06 14:58:11 +08:00
Chris Eagle
e9c6b11506 add mem_api sample program and fix check for wrong NX related constant in cputlb.c 2015-09-04 10:27:03 -07:00
Chris Eagle
8cfd902e4b Move mem_xxx samples to regress. Add check to only flush tlb when unmapping if there is a current cpu 2015-09-04 00:48:24 -07: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
Nguyen Anh Quynh
84e3b5c897 cast all the values to write to registers in uc_reg_write() to unsigned type. this fixes issue #98 2015-09-04 11:17:08 +08: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
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
bd0a6921cc Merge remote-tracking branch 'upstream/master' into change-handle-based-api 2015-09-02 21:04:43 -04: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
2d9db36a2b fix some errors introduced by the last commit on qemu-thread-win32.c 2015-09-02 01:34:23 -07: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
Nguyen Anh Quynh
a94e31165d x86: fix issue #95 2015-09-02 12:00:43 +08:00
Ryan Hileman
db8f499fe9 fix crash on some SSE instructions 2015-09-01 19:12:51 -07:00
Chris Eagle
49d1fa7ebd Merge branch 'master' into mem_map_ex_cse 2015-09-01 12:13:53 -07:00
Chris Eagle
2c4f3769d4 clean up mem_protect related constants and error codes 2015-09-01 12:10:09 -07:00
Jonathon Reinhart
2c802a3e4b Merge remote-tracking branch 'upstream/master' into change-handle-based-api
# Conflicts:
#	qemu/target-i386/unicorn.c
2015-09-01 13:17:03 -04:00
Nguyen Anh Quynh
90fc201f8d x86: enable bunch of instructions via CPUID. this fixes issue #91 2015-09-02 00:16:45 +08:00
Chris Eagle
73027026ce Merge branch 'master' into mem_map_ex_cse 2015-08-31 23:49:54 -07:00
Chris Eagle
658e399776 clean up mem_protect related constants 2015-08-31 19:08:48 -07:00
Nguyen Anh Quynh
bea73ef213 stop emulation when hitting invalid code address. this fixes issue #82 2015-09-01 00:17:55 +08: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
9e4e96ff47 final updates for uc_mem_unmap, uc_mem_protect, and support ro UC_PROT_EXEC permission 2015-08-30 19:50:18 -07:00
mothran
6aa2b73bea removed ifdef for x64 in fpu saving 2015-08-30 19:39:46 -07:00
mothran
e1ab761e8a fixed typo 2015-08-30 19:32:39 -07:00
mothran
2b6f806759 removed testing printf 2015-08-30 19:22:41 -07:00
mothran
4cd5fa3811 fpip x64 fxsave working with using hflags to check CPU mode 2015-08-30 18:56:55 -07:00
mothran
912faf2c3c after closer review, in x64 the the op size is 32 so data32 is set, can removed the unicorn dependency and regress/fpu_ip64.py still works 2015-08-30 18:04:28 -07:00
mothran
2febbb6021 Merge branch 'master' of github.com:unicorn-engine/unicorn into fpip_update 2015-08-30 11:13:23 -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
c23d387e2f remove redundant uc_struct.ram 2015-08-30 10:51:28 +08:00
mothran
b7d60313b5 added 64 bit mode to the fstenv helper function, also a fpu_ip64.py regress script 2015-08-29 01:56:36 -07:00
Chris Eagle
592cbc6eaf conflict resolution with merge master 2015-08-28 23:51:56 -07:00
mothran
79184ff23d Merge branch 'master' of github.com:unicorn-engine/unicorn into fpip_update 2015-08-28 23:40:25 -07:00
Chris Eagle
986096d443 fix file perms 2015-08-28 21:05:38 -07:00
Chris Eagle
94ac0f02e6 file permissions changes 2015-08-28 20:03:36 -07: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
6bd5e2efa7 chmod -x qemu/softmmu_template.h 2015-08-29 09:28:32 +08:00
mothran
feb8ced027 fixed the FPIP updates to correctly only work with non-control instructions and make sure the pc addr is correct 2015-08-28 10:39:11 -07:00
Nguyen Anh Quynh
b69180ad5a Merge branch 'mem_map_ex' of https://github.com/cseagle/unicorn into cseagle-mem_map_ex 2015-08-28 18:47:18 +08:00
Chris Eagle
3452b47f7c Add code to handle non-readable memory 2015-08-28 03:42:25 -07:00
mothran
933ef379b4 restricted fpip updates to only non-control instructions 2015-08-28 03:19:10 -07:00
Nguyen Anh Quynh
3b5df362d7 chmod -x <some source code> 2015-08-28 18:12:56 +08:00
Nguyen Anh Quynh
96a274c4aa Merge branch 'mem_map_ex' of https://github.com/cseagle/unicorn into cseagle-mem_map_ex 2015-08-28 18:11:10 +08:00
Nguyen Anh Quynh
4a1c5ff071 x86: verify until address early when translating block in frontend. this should fix issue #63 2015-08-28 16:06:06 +08: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
mothran
59b09a71bf first shot at getting FPIP working, need to remove all FP control instructions from being updated 2015-08-27 21:54:23 -07:00
Chris Eagle
bf32753c29 Merge branch 'master' into mem_map_ex 2015-08-27 19:17:06 -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
Nguyen Anh Quynh
b335cf016c do not generate basic-block callback when translation is broken in the middle due to full cache (all the remaining archs) 2015-08-27 21:09:00 +08:00
Chris Eagle
4b529bc56c Free up all MemoryRegion* when uc is closed 2015-08-26 14:09:46 -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
Chris Eagle
b39f5d2a91 When checking for invalid memory always do the faster check of whether we are hooking env->uc->hook_mem_idx before doing the expensive check of scanning the memory map 2015-08-26 08:55:19 -07:00
Chris Eagle
095cdb5f9d Merge remote-tracking branch 'upstream/master' 2015-08-26 08:25:37 -07:00
Jonathon Reinhart
8918deb1b2 change uch to uc_struct (target-m68k) 2015-08-26 09:02:16 -04:00
Jonathon Reinhart
fcb099805f change uch to uc_struct (qemu) 2015-08-26 09:02:16 -04:00
Jonathon Reinhart
b57662e43d change uch to uc_struct (target-i386) 2015-08-26 09:02:16 -04:00
Jonathon Reinhart
e7a8eb8976 change uch to uc_struct (target-sparc) 2015-08-26 09:02:16 -04:00
Jonathon Reinhart
15a774ac90 change uch to uc_struct (target-mips) 2015-08-26 09:02:16 -04:00
Jonathon Reinhart
622d5cd5f9 change uch to uc_struct (target-arm) 2015-08-26 09:02:16 -04:00
Jonathon Reinhart
6c4726c88e change uch to uc_struct (ioport.c) 2015-08-26 09:02:16 -04:00
Nguyen Anh Quynh
192f07c503 reset invalid_error after callbacks decide to continue after invalid memory accesses 2015-08-26 16:15:38 +08: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
cc5d28e112 mips: fix issue #39 2015-08-26 09:39:09 +08:00
Nguyen Anh Quynh
2fac7fc2e4 x86: better support for 16bit mode 2015-08-26 00:39:46 +08:00
Nguyen Anh Quynh
39d3856871 when block size is unknown because the translation cache is full, assign it value 0 2015-08-25 16:10:05 +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
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
mothran
2516de7ed8 renamed m68k enum constants 2015-08-23 21:56:24 -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
7ca9a07e1b x86: enable SSE. this fixes issue #3 2015-08-23 10:41:14 +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
Ryan Hileman
0ac3cf99d4 call int80 callback from x86_64 syscall helper 2015-08-21 16:26:02 -07:00
Nguyen Anh Quynh
344d016104 import 2015-08-21 15:04:50 +08:00